Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
yushulx committed Jun 18, 2024
1 parent 716e42c commit 464d73f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions camera_lib/example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ int main()
{
CFileImageTag tag(nullptr, 0, 0);
tag.SetImageId(i);
printf("width: %d, height: %d, stride: %d\n", frame.width, frame.height, frame.stride);
CImageData data(frame.height * frame.stride,
frame.data,
frame.width,
Expand All @@ -162,13 +161,13 @@ int main()
}
}

display_image("1D/2D Barcode Scanner", &frame);
display_frame("1D/2D Barcode Scanner", &frame);
if (wait_key(30) >= 0)
{ // Add a delay and check for key press
release_image(&frame);
release_frame(&frame);
break; // Exit the loop if any key is pressed
}
release_image(&frame);
release_frame(&frame);
}
}
close_camera();
Expand Down
4 changes: 2 additions & 2 deletions camera_lib/include/camera_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ extern "C"
CAMERA_LIB_API int open_camera(int camera_index);
CAMERA_LIB_API void close_camera();
CAMERA_LIB_API ImageData get_frame();
CAMERA_LIB_API void release_image(ImageData *image);
CAMERA_LIB_API void display_image(const char *name, const ImageData *image);
CAMERA_LIB_API void release_frame(ImageData *image);
CAMERA_LIB_API void display_frame(const char *name, const ImageData *image);
CAMERA_LIB_API void draw_line(ImageData *image, int x1, int y1, int x2, int y2, int thickness, int r, int g, int b);
CAMERA_LIB_API void draw_text(ImageData *image, const char *text, int x, int y, int font_scale, int thickness, int r, int g, int b);
CAMERA_LIB_API int wait_key(int delay);
Expand Down
4 changes: 2 additions & 2 deletions camera_lib/src/camera_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ImageData get_frame()
return image;
}

void release_image(ImageData *image)
void release_frame(ImageData *image)
{
if (image->data)
{
Expand All @@ -47,7 +47,7 @@ void release_image(ImageData *image)
}
}

void display_image(const char *name, const ImageData *image)
void display_frame(const char *name, const ImageData *image)
{
if (image && image->data)
{
Expand Down

0 comments on commit 464d73f

Please sign in to comment.