am trying to do a pixel count on an object in a jpeg file,I don't care about the value of each pixel, I just want to count the actual number of pixels in the object, how can I do that? I am using LabView 6.0, and Imaq software any help would be appreciatedHow are you planning to separate the object you are interested in from the background? Do you want to simply draw a boundry for the object on the screen or do you want to pull out the object based on intensity values?
You can perform these types of operations using the IMAQ Vision toolset for LabVIEW. First you would load the image using IMAQ ReadFile. To separate the object based on intensity, pass the loaded image to IMAQ Threshold and tweak the threshold values to get only the object of interest. Alternately, You could draw a boundry for the object by creating an ROI using the freehand tool. Once you have the object selected (by either means) then pass the image to IMAQ Quantify to get statsitics such as number of pixels in the selected area.
If you do not wa
nt to use the Vision toolset, you could load the image, convert it to a 2D array, then use the LabVIEW math operations to find and evaluate the object. This would be considerably more challenging.
You could also do this in a two step process. First load the image in any common image editing program (Photoshop, Paint Shop Pro, etc.) then add a constant value of 1 to all the pixel intensities. Use the selection tool to isolate your object and cut/paste it into a new image with a black background. Save this as a BMP (JPEG will lose some information) and load it into LabVIEW. Then convert the image to an array and count the non-zero values. The constant value of 1 above ensures that none of the pixels of interest will be 0.
Regards,
Brent R.
Applications Engineer
National Instruments