Hey all,

I just started programming C++, (only formiliar with matlab/mathematica for image processing) . I like to find the min of my grayscale image. My image is a part of frame token from a webcam. But I don't even know what type of object my image is. Is it an array, or do I need to convert it first to a 2D array? So I can use a min loop over the pixels?

int main( int argc, char** argv )
{ 
    CvCapture   *capture;
    int         key;

    /* initialize camera */
    capture = cvCaptureFromCAM( 0 );

    /* always check */
    if( !capture ) return 1;

    /* get video properties, needed by template image */
    frame = cvQueryFrame( capture );
    if ( !frame ) return 1;
    
    /* create template image */
    tplLeft = cvCreateImage( cvSize( TPL_WIDTH, TPL_HEIGHT ), 
                         frame->depth, frame->nChannels );

    //load color image specified by first argument
			source = tplLeft;

			// create new image structure 
			// for the grayscale output image
			destination = cvCreateImage(cvSize( source->width, source->height   ), IPL_DEPTH_8U, 1 );

			// set type CV_RGB2GRAY to convert 
			// RGB image to grayscale 
			cvCvtColor( source, destination, CV_RGB2GRAY );

So if you look at my code, destination is my 12 by 12 grayscale image (because tplLeft is 12 by 12). I like to find the min of this image. I'm ussing openCV by the way. Don't know if there any nice functions that will do the trick for me?

thx for looking at my question,

Stefan

Comments
Compensation for previous poster bad comment
sucks balls

Hey,

First of all, thx for the reply. Sounds like a good idea. Found the function but I actually don't know how to use it. Can you please tell me? I got a grayscale image, made with cvCvtColor. So dimensions are 2? (for grayscale?), than size = {12,12}, and type?
Should it by something like this?

myHist = cvCreateHist(2,12,12,?);
cout << cvGetMinMaxValue(myHist);

thx again for looking at my problem!

Stefan

Edited 6 Years Ago by StefanTUE: n/a

This article has been dead for over six months. Start a new discussion instead.