当前位置:网站首页>[GUI development] browsing function implementation model of image processing software
[GUI development] browsing function implementation model of image processing software
2022-06-12 08:33:00 【Pry the fulcrum of the future】
Image processing software includes but is not limited to :
Picture browser ,2D Map browser 、 Picture editor and other software .
To process large resolution images , It is generally used GDAL Load image ,GDAL Part of the image can be dynamically loaded , You can build image pyramids , Optimize loading speed .
General image processing software needs to enlarge the loaded image 、 narrow 、 Pan operation . First of all, clear :
- Zoom in refers to an increase in image detail , A way of browsing with reduced visibility . English name :Zoom In.
- Zoom out is the reduction in image detail , A browsing method that increases the visible range . English name :Zoom Out.
Realization
Here's how to implement .
Before writing code , The mathematical model for image browsing needs to be established . As shown in the figure below :
among , The display window refers to the window used to draw the current browsing content , The observation area refers to , The content in the current display window corresponds to the range of the content in the original drawing . Between the two must meet : The aspect ratio of the display window is the same as that of the viewing area , In pixels .
Using the above model , You can write the corresponding code :
- Image loading display : Use GDAL In the original drawing, the rectangle of the observation area is taken as the range parameter , Read the corresponding pixel data in the original image , The output size is the size of the display window ;
- Zoom in : The display window size does not change , Reduce the viewing area . The center point of the reduced observation area can be set according to the requirements ;
- Zoom out : The display window size does not change , Zoom in on the viewing area . The enlarged center point of the observation area can be set as required ;
- Pan Browse : The display window size does not change , The size of the observation area remains unchanged , However, the position of the observation area is modified according to the offset dragged by the mouse .
It is also convenient to calculate the so-called zoom ratio , namely
Zoom ratio = The width of the display window / The width of the observation area = The length of the display window / The length of the observation area
A unit of length : Pixels
Zoom In、Zoom Out The explanation of
We know Z Axis Is perpendicular to the computer screen , Point to the person in front of the screen , The direction pointing to the inside of the screen is inside .
therefore ,Zoom In It means that people approach the screen to see the content on the screen , It is obviously an increase in detail 、 Zoom in operation with reduced range .
Zoom Out It means that people stay away from the screen to see the content on the screen , This is a reduction in detail . Zoom out of range increase .
Conclusion
In addition to the implementation scheme introduced in the article , There are other options . For example, the viewing area is always set to the same size as the image , Fixed , By changing the display window , To be correct, you should change the size of the drawing cache to zoom in and out . But it can be inferred that , For loading large drawings , If you zoom out in this case , Or occupy too much memory , Or the memory cannot be applied , The speed will also slow down .
Use the scheme introduced in the article , How to realize the requirement of image rotation ? This is left to the readers to think for themselves .
Recently created a official account , Mainly Qt relevant . If you find the article useful , You can focus on that .
边栏推荐
猜你喜欢

Hands on deep learning -- concise implementation code of weight decay

【指針進階三】實現C語言快排函數qsort&回調函數

(p19-p20) delegate constructor (proxy constructor) and inheritance constructor (using)

MSTP的配置与原理

根据有效期显示距离当前还剩多少天有效期

(p36-p39) right value and right value reference, role and use of right value reference, derivation of undetermined reference type, and transfer of right value reference

Centso8 installing mysql8.0 (Part 2)

Py&GO编程技巧篇:逻辑控制避免if else

ctfshow web4
![[dynamic memory management] malloc & calloc and realloc and written test questions and flexible array](/img/d2/a6276d8415c46124920395df5651d1.png)
[dynamic memory management] malloc & calloc and realloc and written test questions and flexible array
随机推荐
Installation series of ROS system (I): installation steps
(p36-p39) right value and right value reference, role and use of right value reference, derivation of undetermined reference type, and transfer of right value reference
Scope of bean
MYSQL中的查询
网站Colab与Kaggle
Webrtc series - mobile terminal hardware coding supports simulcast
MYSQL中的调用存储过程,变量的定义,
Triggers in MySQL
What is the difference between ERP production management and MES management system?
What is an extension method- What are Extension Methods?
Principle and configuration of MPLS
Ankerui motor protector has the functions of overload inverse time limit, overload definite time limit, grounding, starting timeout, leakage, underload, phase failure, locked rotor, etc
Easyexcel exports excel tables to the browser, and exports excel through postman test [introductory case]
MES系统质量追溯功能,到底在追什么?
Hands on deep learning -- image classification dataset fashion MNIST
FDA审查人员称Moderna COVID疫苗对5岁以下儿童安全有效
根据有效期显示距离当前还剩多少天有效期
【指针进阶三】实现C语言快排函数qsort&回调函数
深拷贝与浅拷贝的区别
X64dbg debugging exception_ ACCESS_ VIOLATION C0000005