mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
cvFunction returns a pointer to an image (allows resizes etc)
This commit is contained in:
@@ -41,8 +41,8 @@ uint8_t color_cr_max = 255;
|
|||||||
int color_count = 0;
|
int color_count = 0;
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
bool_t colorfilter_func(struct image_t* img);
|
struct image_t* colorfilter_func(struct image_t* img);
|
||||||
bool_t colorfilter_func(struct image_t* img)
|
struct image_t* colorfilter_func(struct image_t* img)
|
||||||
{
|
{
|
||||||
// Filter
|
// Filter
|
||||||
color_count = image_yuv422_colorfilt(img,img,
|
color_count = image_yuv422_colorfilt(img,img,
|
||||||
@@ -51,7 +51,7 @@ bool_t colorfilter_func(struct image_t* img)
|
|||||||
color_cr_min,color_cr_max
|
color_cr_min,color_cr_max
|
||||||
);
|
);
|
||||||
|
|
||||||
return FALSE;
|
return img; // Colorfilter did not make a new image
|
||||||
}
|
}
|
||||||
|
|
||||||
void colorfilter_init(void)
|
void colorfilter_init(void)
|
||||||
|
|||||||
@@ -42,7 +42,12 @@ void cv_add(cvFunction func)
|
|||||||
|
|
||||||
void cv_run(struct image_t *img)
|
void cv_run(struct image_t *img)
|
||||||
{
|
{
|
||||||
|
struct image_t* temp_image = img;
|
||||||
for (int i = 0; i < cv_func_cnt; i++) {
|
for (int i = 0; i < cv_func_cnt; i++) {
|
||||||
cv_func[i](img);
|
struct image_t* new_image = cv_func[i](temp_image);
|
||||||
|
if (new_image != 0)
|
||||||
|
{
|
||||||
|
temp_image = new_image;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "std.h"
|
#include "std.h"
|
||||||
#include "lib/vision/image.h"
|
#include "lib/vision/image.h"
|
||||||
|
|
||||||
typedef bool_t (*cvFunction)(struct image_t *img);
|
typedef struct image_t* (*cvFunction)(struct image_t *img);
|
||||||
|
|
||||||
extern void cv_add(cvFunction func);
|
extern void cv_add(cvFunction func);
|
||||||
extern void cv_run(struct image_t *img);
|
extern void cv_run(struct image_t *img);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ bool_t cv_blob_locator_func(struct image_t *img);
|
|||||||
bool_t cv_blob_locator_func(struct image_t *img) {
|
bool_t cv_blob_locator_func(struct image_t *img) {
|
||||||
|
|
||||||
if (!blob_enabled)
|
if (!blob_enabled)
|
||||||
return FALSE;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
// Color Filter
|
// Color Filter
|
||||||
@@ -209,7 +209,7 @@ bool_t cv_blob_locator_func(struct image_t *img) {
|
|||||||
|
|
||||||
image_free(&dst);
|
image_free(&dst);
|
||||||
|
|
||||||
return FALSE;
|
return 0; // No new image is available for follow up modules
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "modules/computer_vision/cv_georeference.h"
|
#include "modules/computer_vision/cv_georeference.h"
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ extern bool_t detect_window(struct image_t *img)
|
|||||||
printf("Response = %d\n", response);
|
printf("Response = %d\n", response);
|
||||||
|
|
||||||
image_free(&gray);
|
image_free(&gray);
|
||||||
return 1;
|
return 0; // No new image was created
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void qrcode_init(void)
|
|||||||
|
|
||||||
zbar_image_scanner_t *scanner = 0;
|
zbar_image_scanner_t *scanner = 0;
|
||||||
|
|
||||||
bool_t qrscan(struct image_t *img)
|
struct image_t* qrscan(struct image_t *img)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
@@ -98,4 +98,6 @@ bool_t qrscan(struct image_t *img)
|
|||||||
// clean up
|
// clean up
|
||||||
zbar_image_destroy(image);
|
zbar_image_destroy(image);
|
||||||
//zbar_image_scanner_destroy(scanner);
|
//zbar_image_scanner_destroy(scanner);
|
||||||
|
|
||||||
|
return 0; // QRCode is not returning a new image.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ bool_t viewvideo_function(struct image_t *img)
|
|||||||
// Free all buffers
|
// Free all buffers
|
||||||
image_free(&img_jpeg);
|
image_free(&img_jpeg);
|
||||||
image_free(&img_small);
|
image_free(&img_small);
|
||||||
return TRUE;
|
return 0; // No new images were created
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user