Ask Your Question

Revision history [back]

Make 32x32 sections on an image in C++ OpenCV?

Im trying to divide a passed in, gray scaled image and divide it into 32x32 "blocks" or "sections". Sort of like an imaginary, overlay grid.

Once this is done, I need to loop through each pixel in each individual section to perform analysis on the single channel, gray scale value that is returned by each pixel.

For example:

// For region (x,y)

if pixelVal >= 120 && pixelVal <= 130{

bitStream += "1"; }

else if pixelVal >= 135 && pixelVal <= 140{

bitstream += "0"; }

else{

bitStream += "X"; }

Does this make sense? I'm very new to OpenCV and C++ and basically I know how to show, loop through, and return the pixel value at a given point, just not within a certain, predetermined area. Im thinking about creating some sort of window that loops through? I just have no idea how to code it.