Skip to content

Instantly share code, notes, and snippets.

@dgzlopes
Created February 21, 2019 09:21
Show Gist options
  • Save dgzlopes/c2178e463afd0da759ae670f863f1a4d to your computer and use it in GitHub Desktop.
Save dgzlopes/c2178e463afd0da759ae670f863f1a4d to your computer and use it in GitHub Desktop.
int main(int argc, char **argv) {
if (argc != 2) {
printf("Error: Usage %s image_file_name\n", argv[0]);
return EXIT_FAILURE;
}
//CV_LOAD_IMAGE_COLOR = 1 forces the resultant IplImage to be colour.
//CV_LOAD_IMAGE_GRAYSCALE = 0 forces a greyscale IplImage.
//CV_LOAD_IMAGE_UNCHANGED = -1
IplImage* ImgDestino = cvCreateImage(cvSize(640, 480),IPL_DEPTH_8S, 4);
// Always check if the program can find the image file
if (!ImgDestino) {
printf("Error: file %s not found\n", argv[1]);
return EXIT_FAILURE;
}
int fila, cc;
for(fila = 0; fila < ImgDestino->height; fila++) {
__m128i*pImgDestino = (__m128i*) (ImgDestino->imageData + fila*ImgDestino->widthStep);
for(cc = 0; cc < ImgDestino->widthStep; cc=cc+16) {
*pImgDestino = _mm_set1_epi32(0x24522480);
*pImgDestino++;
}
}
cvShowImage("Imagen Yellow", ImgDestino);
cvWaitKey(0);
// memory release for images before exiting the application
cvReleaseImage(&ImgDestino);
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment