Re: Way to convert a cv::Mat object to a wxBitmap or wxImage

Rossano Paris <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
Hi, AsmWarrior
I've seen such example, but in my case I wasn't be able to make it working
That's why I've decided to lokk at the way OPENCV uses in order to paint a 
cv:Mat under MSW
As I've already written my code is based on: link to code 
<https://github.com/opencv/opencv/blob/master/modules/highgui/src/window_w32.cpp>
Thanks to OPENCV file example I could achive my aim, unfortunatelly with 
other code I've found around I couldn't.

Regards
Rossano
On Thursday, 30 March 2023 at 07:36:06 UTC+2 AsmWarrior wrote:

> Hi, Rossano Paris, thanks for the sharing. 
> I just looked at the cpp file, it looks like the second way is just like 
> the same way as mentioned in PB's project:
> https://github.com/PBfordev/wxopencvtest/blob/main/convertmattowxbmp.cpp 
> In the function ConvertMatBitmapTowxBitmapMSW.
> What do you think about it?
> Thanks.
> Asmarrior
> On Wednesday, March 22, 2023 at 1:16:58 AM UTC+8 Rossano Paris wrote:
>
>> Hallo at all
>> I'd like to offer my way to achieve what I asked days ago ...
>>
>> Here attached you can find a class useful to convert a cv::Mat object to 
>> a wxWidgets image object.
>> There are two different way to make the conversion, one based on opencv 
>> functions *(1)*, which is very slow and the faster one *(2),* which is 
>> based on this code: link to code 
>> <https://github.com/opencv/opencv/blob/master/modules/highgui/src/window_w32.cpp>
>>
>> *(1)* static const wxImage cvMatToWxImage(const cv::Mat& image, 
>> wxBitmapType imgtype, std::vector<int> par);
>> *(2)* const wxImage wxhOpenCvTools::cvMatToWxImage(wxWindow* pWindow, 
>> const cv::Mat& image)
>>
>> best regards
>> Rossano
>>
>> On Sunday, 12 February 2023 at 14:27:43 UTC+1 Rossano Paris wrote:
>>
>>> Thank you Eric for your tips
>>> I'll take a look at them
>>>
>>> On Thursday, 9 February 2023 at 14:02:50 UTC+1 Eric Jensen wrote:
>>>
>>>> Hello Rossano, 
>>>>
>>>> Thursday, February 9, 2023, 12:57:38 PM, you wrote: 
>>>>
>>>> RP> Hallo at all. 
>>>>
>>>> RP> I came here to ask someone a more conveninet way to convert a 
>>>> cv::Mat image 
>>>> RP> to BMP. 
>>>> RP> Expecially talking about loading such image from memory. 
>>>>
>>>> Code: 
>>>> https://github.com/PBfordev/wxopencvtest/blob/main/convertmattowxbmp.cpp 
>>>>
>>>> Related forum post: 
>>>> https://forums.wxwidgets.org/viewtopic.php?f=20&t=47603 
>>>>
>>>> Documentation for bitmap raw pixel access: 
>>>> https://docs.wxwidgets.org/trunk/classwx_pixel_data.html 
>>>>
>>>> Credit to PB (pbfordev) 
>>>>
>>>> Hth 
>>>> Eric 
>>>>
>>>>
>>>> -- 
>>>>
>>>>

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/9eb90e85-7467-423b-8d8c-5ec119fb8c87n%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.