X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 18 Jan 2007 06:22 PM by  anon
Dead pixels on image
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
18 Jan 2007 06:22 PM
    Hello, I am fairly new to IDL, so this will be a simpler question (I think). I have an image that has been taken with a camera that has some dead pixels. i.e. the image is littered with dark spots. I need to count how many of those areas there are. I am thinking of trying to find_boundary of those areas, and draw a boundary and count how many of those I come up with....not really sure how to do that though. Any help is appreciated. Thank You!! Radha

    Deleted User



    New Member


    Posts:
    New Member


    --
    18 Jan 2007 06:22 PM
    I don't know if this is the best way, but the below algorithm provides one way - based on IDL's LABEL_REGION function - that does not require many code lines: ; Make some simple dummy 400 x 400 image data seed = 1 temp = byte(randomu(seed,10,10) * 10) image = rebin(temp, 400, 400) window, XSIZE=400, YSIZE=400, /FREE, TITLE='Original Image' tvscl, image ; Let's make a threshold that considers ~10% of image to be dead pixels threshold = 1b deadPixelIndices = where(image le threshold) ; Make a binary image from these indices ; LABEL_REGION will need dead pixels to be the only values gt 0 deadPixelMask = bytarr(400, 400) deadPixelMask[deadPixelIndices] = 255b window, XSIZE=400, YSIZE=400, /FREE, TITLE='Dead Pixels In White' tvscl, deadPixelMask ; This example produces 12 larger regions. Let's add one small 1-pixel ; region at the edge of the mask deadPixelMask[150,0] = 255b tvscl, deadPixelMask ; LABEL_REGION does not find regions or parts of regions that are ; on any outside edge of the image. That is why we make this extra ; image object maskWithExtraBorder = bytarr(402,402) maskWithExtraBorder[1,1] = deadPixelMask ; Center mask in new image result = label_region(maskWithExtraBorder, /ALL_NEIGHBORS) nDeadPixelRegions = max(result) ; 13 Best of luck, James Jones
    You are not authorized to post a reply.