0

I am using a Binary buffered image with two objects in the image the 1cm square object (reference object) and the leaf and i wish to count and display the separate black pixels of the object and the leaf. If anyone could tell me how to implement this. It would be greatly appreciated...! Thank you :)

Edited by deceptikon: Moved to software dev

2
Contributors
1
Reply
14
Views
4 Years
Discussion Span
Last Post by rubberman
0

How many pixels per row and column in the total image are there? Also, how many pixels per cm are there? Your problem is how to locate the offsets in the buffer where the images exist, and then look at the pixels in those ranges. There are a number of techniques to do that, but writing up the pseudo-code to model what you need to do will help. Example (not complete, and may not be correct):

get buffer size in bytes
get pixel size in bytes (32bits == 4bytes)
calculate number of pixel rows and columns in reference object
calculate number of pixel rows and columns in leaf object
get number of pixel-sized rows in image
get number of pixel-sized columns in image
get location of reference object (row,column) top left corner
get location of leaf object (row,column) top left corner
for each row in reference object
    skip to start of row in buffer
    for each pixel in row
        if pixel is black, save pixel location
    endfor
endfor
for each row in leaf object
    // see reference object loop above
endfor

Consider the displaying part to be an exercise.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.