Canvas is cool! - page 65

 
Nikolai Semko:
Well, very briefly, Artem, I used to perceive a pixel as a square with calculation of its weight participation in a pixel of a new scale through area, now I would perceive it as a circle with calculation of its weight participation through the distance to the centre of a pixel of a new scale.
Thanks, that's interesting.
 
Nikolai Semko:

I gave an example of the codehere. But the code is far from perfect. I'd do it completely differently now.


Oh, wow! I've changed the code a bit. Took the resize function out of the class into a separate file for universal use and added the ability to resize disproportionately.
Files:
ImageResize.zip  384 kb
 
Nikolay Kositsin:
Amazing! I have changed the code a bit. I took the resize function out of the class into a separate file for universal use and added the capability of disproportionate resizing.

Well, actually the algorithm is terrible. I remember writing it in one day purely to test it, to make it work and see how colour is preserved when transformed.
It is very slow (you can see blinks and I remember some glitches), but there is a great potential to speed it up many times.
Now, to rewrite this resize, based on the knowledge and experience I gained after that code, I think it will take me three days.
But maybe it would be better to find something ready-made instead of re-inventing the wheel.
For example, here is a free library in C++, though old, but quite working.
https://drive.google.com/file/d/1BceTk-OrtQza0Hpozhm1nqAcNkRdeNH5/view?usp=sharing
Look demo example image_perspective.



 
Nikolai Semko:

Well, actually the algorithm is terrible. I remember writing it in one day purely to test it, to see how colour is retained during transformation.
It is very slow (you can see blinks and I remember some glitches), but there is a great potential to speed it up many times.
Now, to rewrite this resize, based on the knowledge and experience I gained after that code, I think it will take me three days.
But maybe it would be better to find something ready-made instead of re-inventing the wheel.
For example, here is a free library in C++, it's an old one, but it works fine.
https://drive.google.com/file/d/1BceTk-OrtQza0Hpozhm1nqAcNkRdeNH5/view?usp=sharing
Look at demo example image_perspective.


Well, as a matter of fact, it was supposed to do so, but it turned out that on this very topic in particular in the Internet all information was somehow moth-eaten. I am not sure whether the owner of the link will give permission to download it or not.
 
Nikolay Kositsin:
Well, as a matter of fact, it was supposed to do so, but as it turned out that on this particular topic in the Internet all the information was somehow moth-eaten. For the link thank you, but it is coded and whether the owner of the link permission to download - it is not clear.

Corrected. It opens without a password.

 
Nikolai Semko:

I agree with Renat that even using the CPU for graphics output covers more than 99% of all graphics tasks in the MQL5 task area.

I have a lot of CPU load on the GUI of the Terminal itself.

 
Nikolai Semko:

Corrected. It opens without a password.

Nikolai, which side of the library should I dig into? I've probed it with all available analysis methods, but I haven't found any re-sizing or resampling of pixel arrays and images.
 
fxsaber:

I'm getting a lot of CPU load from the GUI of the Terminal itself.

Ryzen 3700x and GTX1060 also make a difference to roll up or not, developers are going with the times reducing responsiveness closer to real time, time to change your ancient processor, 2700K isn't it?

 
Fast235:

Ryzen 3700x and GTX1060 also make a difference to roll up or not, developers are going with the times reducing responsiveness closer to realtime, time to change your ancient processor, 2700K like?

Yeah. I don't think developers ever run five Terminals in parallel, where high frequency cotiers of a hundred characters each arrive in the Market Review.

It comes out very silly when trivial minimisation of such Terminals reduces a large CPU load to almost nothing. Why such an irrationally CPU-consuming GUI is necessary is unclear.

 
fxsaber:

Yes. I don't think developers ever run five Terminals in parallel, where high frequency Market Watch has hundreds of characters each.

It comes out very silly when trivial minimisation of such Terminals reduces a large CPU load to almost nothing. Why such an irrationally consuming GUI is incomprehensible.

they comply with the dresscode, google there are an incredible amount of obvious flaws for everyone, but everything gets overlooked, MQ is very keen to be like these giants

Reason: