c++ - Programmatically control zoom Opencv -


i've written simple program in opencv open tiff image. program identical this post (save 2 lines) i'll add here clarity:

#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream>  using namespace cv; using namespace std;  int main( int argc, char** argv ) {  if( argc != 2)  {  cout <<" usage: display_image imagetoloadanddisplay" << endl;  return -1;  }   mat image;  image = imread(argv[1], cv_load_image_color);   // read file   if(! image.data )                              // check invalid input  {     cout <<  "could not open or find image" << std::endl ;     return -1;  }   namedwindow( "display window", window_autosize );// create window display.  imshow( "display window", image );                   // show our image inside it.  movewindow("display window",0,0); //set window postion top left  setwindowproperty("display window", cv_wnd_prop_fullscreen, cv_window_fullscreen); //make fullscreen   waitkey(0);                                          // wait keystroke in window  return 0; 

}

i've added 2 lines ensure image opens top left , full screen (the second line may or may not used in future). perform same action when roll mouse wheel , "zoom" on image i'd control precisely control a) position , b) level of zoom "blue" window in following image (achieved scrolling mouse normally). enter image description here. you'll notice small grey window @ top of image indicating how , 'zoomed' in portion of image is. how can control 'zoomed' window in code?

you can create cv::mat object containing final image. then, first write scaled , cropped portion, , write "zoomed in" window roi of final image.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -