Re: Way to convert a cv::Mat object to a wxBitmap or wxImage
AsmWarrior <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
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/8cf58738-0ca3-4320-af00-3bc48def0c5cn%40googlegroups.com.