I need help with image processing using code composer studio. The following code
ID: 3827546 • Letter: I
Question
I need help with image processing using code composer studio.
The following code is for converting an image to gray scale.
I need to modify this code into different image processing.
Can anyone help me?
CODE:
#include
#define XSIZE 400
#define YSIZE 300
#define NUM_PIXELS (XSIZE * YSIZE)
#pragma DATA_SECTION(imgBuffer, "myDDR2");
unsigned int imgBuffer[NUM_PIXELS];
unsigned int imgGray[NUM_PIXELS];
void main (void){
while(1);
}
void ConvertGrayscale()
{
int x, y;
unsigned char r, g, b, gray;
for (y=0; y {
for (x=0; x {
r = *(((unsigned char*)imgBuffer) + (((y * XSIZE) + x ) * 4) + 3);
g = *(((unsigned char*)imgBuffer) + (((y * XSIZE) + x ) * 4) + 2);
b = *(((unsigned char*)imgBuffer) + (((y * XSIZE) + x ) * 4) + 1);
gray = (unsigned char)(0.299 * r + 0.587 * g + 0.114 * b);
*(((unsigned char*)imgGray) + (((y * XSIZE) + x ) * 4) + 3) = gray ;
*(((unsigned char*)imgGray) + (((y * XSIZE) + x ) * 4) + 2) = gray ;
*(((unsigned char*)imgGray) + (((y * XSIZE) + x ) * 4) + 1) = gray ;
}
}
}
" Do you need code for some specific image conversion? "
- Yes, different codes can help me to do the job in ccs. I am looking for different image conversion like above effect, for example) histogram, enhancement, filters, and etc. thank you
Explanation / Answer
void convert(CImage* pcImage) { ASSERT(pcImage); int iWidth(pcImage->GetWidth()); int iHeight(pcImage->GetHeight()); if (iWidth && iHeight) { for (int i = 0; i SetPixel(i, j, RGB(fWB, fWB, fWB)); } } } }Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.