Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unexpected error during execution

Is a simple program for add +30 in intesitys, but it stop during the 'for'

#include "stdafx.h"


#include < opencv2/opencv.hpp >

#include < iostream >

#include < opencv2/imgproc/imgproc.hpp >


using namespace cv;

using namespace std;

Vec3b logPoint(Vec3b RGB) {
    Vec3b res;
    res[0] = RGB[0]+30;
    res[1] = RGB[1]+30;


    return res;
}

int main(int argc, char** argv)
{


    //ABRE A IMAGEM->CINZA e MOSTRA
    Mat img = imread("img.jpg", IMREAD_GRAYSCALE);
    Mat dest(img.size().width, img.size().height,CV_8SC1);



for (int i = 0; i-1 < img.rows; i++) {
    for (int j = 0; j-1 < img.cols; j++) {
        Vec3b pixel = img.at<Vec3b>(i,j);
        dest.at<Vec3b>(i, j) = logPoint(pixel);

        //cout << logPoint(pixel)[0] << "|" << logPoint(pixel)[1]<<endl;

    }
}

namedWindow("img", WINDOW_AUTOSIZE);
imshow("img", img);
if(waitKey(0) == 27) destroyAllWindows();


return 0;

}