1
I am trying to perform a simple sum operation that adds 30 to the intensities on each channel, but the program only hangs without error output (probably some type error).
I hit that reply
// Codigos1.cpp : define o ponto de entrada para o aplicativo do console.
//
#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;
}