I was using opencv 2.3 o my project two years ago with the cvSet2D, but i use the command with opencv 3.4 i receive the message undeclared identifier

i was using opencv 2.3 o my project two years ago with the cvSet2D, but i use the command with opencv 3.4 i receive the message undeclared identifier

the c-api is dead (since 10+ years !), no more maintained,
and removed from the current codebase.
you must NOT use it.

tell us, what your project is doing,
then we can help you rewriting it (from scratch) in c++,
point you at more modern samples, docs, etc.

thanks, i was working in treatment of image in advanced desert
that’s the part of code


Mat mat2image(int **matrice)
{
	Mat image;
	Scalar pixel_val;
	int x, y;
	image.create(Size(Activerows, Activecols),3);// IPL_DEPTH_8U
																		   //for (x = 0; x<image->width; x++)
																		   //for (y = 0; y<image->height; y++)
	for (x = 0; x<Activerows; x++)
		for (y = 0; y<Activecols; y++)
		{
		//	pixel_val = image.at.cvGet2D(image,x, y);//toutes les composantes YCrCb
			pixel_val = image.at<int>(x,y);//toutes les composantes YCrCb
			pixel_val.val[0] = matrice[x][y];//Y
			image.at.cvSet2D(image,x, y, pixel_val);
		}

	return (image);
}

some questions first:

so, you want to composite a YCrCb, and have the Y in matrice.

  • where do the other channels come from ?
  • youre confusing x <-> y, rows <-> cols here, that’s terrible … , but what about matrice again ?
    is it “row-mayor” ([y][x]) ?
    does it have continuous memory or “double pointers” ?

Thanks,
I have a matric that i need to set a pixel to x and y positions where x represent a row position and y represent colon position
last time i was using cvSet2D with opencv2 but when i use it now i receive the message:
Erreur C2228 la partie gauche de ‘.cvSet2D’ doit avoir un class/struct/union

assuming, Activerows, Activecols actually mean, what they say,
try to stick with conventional x:cols, y:rows indexing

	Mat image(Activerows, Activecols, CV_8UC3);  // Mat is 'row major'

	for (int x = 0; x<Activecols; x++)
		for (y = 0; y<Activerows; y++)
		{
            // get a *reference* to the pixel,
            // make sure to get the type right, CV_8UC3 <--> Vec3b
			Vec3b &pixel_val = image.at<Vec3b>(y,x);//toutes les composantes YCrCb
			pixel_val[0] = matrice[y][x];//Y
			pixel_val[1] = ????;//Cr
			pixel_val[2] = ????;//Cb
            // no need to 'set' anything, it's a reference
		}

for further reference, please read tutorials