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 :)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.