FIx crop ratio
This commit is contained in:
parent
d1687fb7cb
commit
37816cd161
1 changed files with 18 additions and 13 deletions
|
@ -13,7 +13,7 @@ using namespace std;
|
||||||
|
|
||||||
class Traite_image {
|
class Traite_image {
|
||||||
public:
|
public:
|
||||||
const static int SENSITIVITY_VALUE = 30;
|
const static int SENSITIVITY_VALUE = 40;
|
||||||
const static int BLUR_SIZE = 10;
|
const static int BLUR_SIZE = 10;
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,16 +67,21 @@ class Traite_image {
|
||||||
|
|
||||||
Mat next_stab;
|
Mat next_stab;
|
||||||
stabiliseImg(prev, next, next_stab);
|
stabiliseImg(prev, next, next_stab);
|
||||||
Rect myROI(next_stab.size().width/8, next_stab.size().height/8, next_stab.size().width*3/4, next_stab.size().height*3/4);
|
int crop_ratio = 6;
|
||||||
Mat next_stab_cropped = next_stab(myROI);
|
float crop_x = next_stab.size().width/crop_ratio;
|
||||||
Mat prev_cropped = prev(myROI);
|
float crop_y = next_stab.size().height/crop_ratio;
|
||||||
|
float crop_w = next_stab.size().width*(1-2.0/crop_ratio);
|
||||||
|
float crop_h = next_stab.size().height*(1-2.0/crop_ratio);
|
||||||
|
Rect myROI(crop_x, crop_y, crop_w, crop_h);
|
||||||
|
Mat next_stab_cropped = next_stab(myROI);
|
||||||
|
Mat prev_cropped = prev(myROI);
|
||||||
searchForMovement(prev_cropped, next_stab_cropped, output);
|
searchForMovement(prev_cropped, next_stab_cropped, output);
|
||||||
|
|
||||||
|
|
||||||
pub_img.publish(cv_bridge::CvImage(msg->header, "rgb8", output).toImageMsg());
|
pub_img.publish(cv_bridge::CvImage(msg->header, "rgb8", output).toImageMsg());
|
||||||
// bridge_input is handled by a smart-pointer. No explicit delete needed.
|
// bridge_input is handled by a smart-pointer. No explicit delete needed.
|
||||||
|
|
||||||
droneTracking(Rect(Point(0,0), output.size()));
|
//droneTracking(Rect(Point(0,0), output.size()));
|
||||||
|
|
||||||
//ROS_INFO("pub");
|
//ROS_INFO("pub");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue