Tool/software: Code Composer Studio
Hi,
I noticed there is a function called APP_drawBoxRGB() in PROCESSOR_SDK_VISION_03_03_00_00\ti_components\algorithms\eve_sw_01_18_01_00\common ti_draw_utils.c and ti_draw_utils.h files.
source code is :
void
APP_drawBoxRGB
(
uint8_t * srcR,
uint8_t * srcG,
uint8_t * srcB,
uint32_t rgb24bit,
int16_t cols,
int16_t x1,
int16_t y1,
int16_t x2,
int16_t y2
)
{
uint16_t left;
uint16_t right;
uint16_t top;
uint16_t bottom;
uint16_t y;
uint32_t offset;
uint8_t r = (rgb24bit >> 16) & 0xff;
uint8_t g = (rgb24bit >> 8 ) & 0xff;
uint8_t b = (rgb24bit ) & 0xff;
left = x1;
right = x2;
top = y1;
bottom = y2;
// draw top boundary line
offset = cols * top + left;
memset(&srcR[offset], r, right - left + 1);
memset(&srcG[offset], g, right - left + 1);
memset(&srcB[offset], b, right - left + 1);
// draw left & right boundary lines
for (y = top+1; y <= bottom; y++)
{
// left
srcR[offset] = r;
srcG[offset] = g;
srcB[offset] = b;
srcR[offset + (right - left)] = r;
srcG[offset + (right - left)] = g;
srcB[offset + (right - left)] = b;
// incrememt offset for next row
offset += cols;
}
// draw bottom boundary lines
offset = cols * bottom + left;
memset(&srcR[offset], r, right - left + 1);
memset(&srcG[offset], g, right - left + 1);
memset(&srcB[offset], b, right - left + 1);
}
I want to draw a box in .rgb picture file,but failed.
int main()
{
FILE* fd = fopen("D:\\bigmap.rgb","rb");
unsigned int length = fread(imageSrc_buffer, 3, size, fd);
if (length != size)
{
printf("bigmap is not right\n");
}
fclose(fd);
uint8_t *image_blue;
uint8_t *image_green;
uint8_t *image_red;
int i = 0,j = 0;
for(i=0;i<heightSrc;i++){
for(j=0;j<widthSrc;j++){
*(image_red+i*widthSrc+j) =*(imageSrc_buffer+i*widthSrc*3+j*3+0);
*(image_green+i*widthSrc+j)=*(imageSrc_buffer+i*widthSrc*3+j*3+1);
*(image_blue+i*widthSrc+j) =*(imageSrc_buffer+i*widthSrc*3+j*3+2);
}
}
APP_drawBoxRGB (image_red,image_green,image_blue,255,352*3,50,50,200,200);
return 0;
}
So is there any file I can refer to?
Or is there anything you can do to help?