-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "test_image.hpp" | ||
|
||
int test_find_blobs(image::Image *img) { | ||
std::vector<maix::image::Blob> blobs; | ||
std::vector<std::vector<int>> thresholds = {{46, 66, 41, 61, 3, 23}}; | ||
bool invert = false; | ||
int x_stride = 2; | ||
int y_stride = 1; | ||
int area_threshold = 500; | ||
int pixels_threshold = 500; | ||
std::vector<int> roi = {1, 1, img->width()- 1, img->height() - 1}; | ||
blobs = img->find_blobs(thresholds, invert, roi, x_stride, y_stride, area_threshold, pixels_threshold); | ||
for (auto &a : blobs) { | ||
std::vector<std::vector<int>> mini_corners = a.mini_corners(); | ||
for (int i = 0; i < 4; i ++) { | ||
img->draw_line(mini_corners[i][0], mini_corners[i][1], mini_corners[(i + 1) % 4][0], mini_corners[(i + 1) % 4][1], maix::image::Color::from_rgb(0, 255, 0), 2); | ||
} | ||
} | ||
return 0; | ||
} |
4 changes: 1 addition & 3 deletions
4
...e_method/main/src/test_image_gaussian.cpp → ...s/image_method/main/src/test_gaussian.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef __TEST_IMAGE__HPP | ||
#define __TEST_IMAGE__HPP | ||
|
||
#include "maix_vision.hpp" | ||
|
||
using namespace maix; | ||
|
||
int test_find_blobs(image::Image *img); | ||
int test_gaussion(image::Image *img); | ||
|
||
#endif |