Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color Detector model's Size bias issue (AIV-657) #141

Open
ajtwlsdlqp opened this issue Oct 16, 2023 · 4 comments
Open

Color Detector model's Size bias issue (AIV-657) #141

ajtwlsdlqp opened this issue Oct 16, 2023 · 4 comments

Comments

@ajtwlsdlqp
Copy link

Hi.

I am using IDF version 4.4, and I have a question regarding the color detection feature. I'd like to know if this is a known bug or if there might be some misconfiguration causing the following issue:

I am capturing two frames of size 320x240 in RGB565/BMP format and attempting color detection. The functionality seems to work well. Based on the detected region's starting position, height, and width, I'm displaying the detected region on an LCD. For images that are wider, the width is accurately represented, but for images that are taller, the width is not displayed correctly; instead, it is recognized as a square shape.

Is there a way to resolve this issue?
Thank you for your assistance.

@github-actions github-actions bot changed the title Color Detector model's Size bias issue Color Detector model's Size bias issue (AIV-657) Oct 16, 2023
@Sandra-lol
Copy link

Hello~
Looks like it's more of a display issue, could you check the lcd driver?

@ajtwlsdlqp
Copy link
Author

@Sandra-lol
Thank you for your advice.

I am not directly using an LCD but transmitting the obtained coordinates and dimensions to another device for display.
I have logged the obtained coordinates' width and height values in IDF Monitor for verification.
For shapes that are taller in the vertical direction, the height is not being accurately detected and is displayed as a square with the same value as the width.

Thank you for your assistance.

@Sandra-lol
Copy link

hello~
Since you may not be using the example from this repo, could you provide any code for better analysis?

@ajtwlsdlqp
Copy link
Author

@Sandra-lol
Sure, Please check my code.

`
registerCamera(PIXFORMAT_RGB565, FRAMESIZE_QVGA, 2, info.xQueueAIFrame);

static void threadCameraHandler(void *arg)
{
// cliPrintf("threadCameraHandler \n");
while (true)
{
camera_fb_t *frame = esp_camera_fb_get();
if (frame)
{
xQueueSend(xQueueFrameO, &frame, 0xFFFFFFFF);
}

taskYIELD();

}
}

if (xQueueReceive(info.xQueueFrameI, &frame, portMAX_DELAY))
{
switch( info.cam_ap_select)
{
...
...
case CAM_AP_COLOR_DETECT :
{
latency.start();

      std::vector<std::vector<color_detect_result_t>> &results = detector_color.detect((uint16_t *)frame->buf, {(int)frame->height, (int)frame->width, 3} );

      latency.end();

      color_buff_idx = 0;
      decrease_color = 0;

      // 10 * 1
      for( int m=0; m<12; m++)
        color_info.detect_cnt[m] = 0;

      for (int i = 0; i < results.size(); ++i)
      {
        draw_color_detection_result((uint16_t *)frame->buf, (int)frame->height, (int)frame->width, results[i], draw_lcd_color[i % draw_colors_num], i);
      }
    }
    if (return_frambuffer) esp_camera_fb_return(frame);
    else free(frame);

    break;

}
}
`

Thank you for your assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants