Search found 17 matches

by nalisaki
Sun Apr 08, 2012 7:05 am
Forum: C++ Development
Topic: how to initialize a wxframe object
Replies: 5
Views: 1595

Re: how to initialize a wxframe object

Thanks, but how and where should I send wxEVT_CREATE? I use the codeblock10.05 to code, and it shows no wxEVT_CREATE, I use the 2.9.X wxXidgets.
by nalisaki
Fri Apr 06, 2012 10:20 am
Forum: C++ Development
Topic: how to initialize a wxframe object
Replies: 5
Views: 1595

how to initialize a wxframe object

I mean is there any EVT I can use to initialize it? Or it can only be initialized in its constructor? Can EVT_ENTER_WINDOW do this work?
by nalisaki
Sat Mar 31, 2012 3:40 am
Forum: C++ Development
Topic: image contructor's problem
Replies: 4
Views: 1189

Re: image contructor's problem

the colour problem has been solved. Just like the doublemax said. Maybe the data I gotten is not in a RGB order data but BGR order. Even it showes right after I convert RGB datar to BGR data, however when I save the RGB data into a file, it shows right in picture viewer.
by nalisaki
Fri Mar 30, 2012 12:26 pm
Forum: C++ Development
Topic: image contructor's problem
Replies: 4
Views: 1189

Re: image contructor's problem

What failed? What happened? Did it crash, did it do nothing, did the image look wrong? When i said it failed, i used the member function ”wxImage.saveFile()“ to save the image to a file to campare it to the original data I gotten. When I did this , the "saveFile" returned false. Any suggestion? Tha...
by nalisaki
Thu Mar 29, 2012 11:26 am
Forum: C++ Development
Topic: image contructor's problem
Replies: 4
Views: 1189

image contructor's problem

I have gotten some RGB data formed in an array. When I used the data to construct a wxImage object via the followed constructor: wxImage::wxImage ( int width, int height, unsigned char * data, bool static_data = false ) , it failed. However, using the Create method: bool wxImage::Create ( int width,...
by nalisaki
Thu Mar 29, 2012 11:13 am
Forum: C++ Development
Topic: how to display a bitmap in wxStaticBitmap?
Replies: 13
Views: 5367

Re: how to display a bitmap in wxStaticBitmap?

the problem has solved.
I used the common linux detachable thread but not wxThread. Because when using the wxThread, the video seemed lagged a bit. I don't know why.
by nalisaki
Wed Mar 28, 2012 5:11 am
Forum: wxWidgets Development (Chinese)
Topic: 用bmp的原始數據怎麼構造一個wximage
Replies: 2
Views: 3909

Re: 用bmp的原始數據怎麼構造一個wximage

我用wximage的Create函數解決了。 具體代碼是: wxMutexGuiEnter(); wxImage imgTmp; imgTmp.Create(width,height,Buffer, true); wxBitmap bmpTmp(imgTmp); wxMemoryDC memDC; memDC.SelectObject(bmpTmp); wxClientDC destDC(Panel2); //wxPaintDC destDC(Panel2); destDC.Blit(4, 4, // Draw at (100, 100) bmpTmp.GetWidth(), bmpTmp.G...
by nalisaki
Mon Mar 26, 2012 12:07 pm
Forum: wxWidgets Development (Chinese)
Topic: 用bmp的原始數據怎麼構造一個wximage
Replies: 2
Views: 3909

用bmp的原始數據怎麼構造一個wximage

bmp的原始數據是指一幅.bmp圖像在內存中的映像。用 wxImage (int width, int height, unsigned char *data, bool static_data=false)這個構造不成功啊,這個構造函數的參考資料(官方網站上的)對unsigned char* data這個參數的解釋並不是很清楚,它的格式應該是怎樣的呢?還有其他方法嗎?多謝!
by nalisaki
Mon Mar 26, 2012 3:24 am
Forum: wxWidgets Development (Chinese)
Topic: 用wxStaticBitmap控件显示从网络摄像头获取的数据
Replies: 4
Views: 5430

Re: 用wxStaticBitmap控件显示从网络摄像头获取的数据

细看了一下你的代码,你为了构造一个wxBitmap对象,你按照BMP的文件格式构造了bufB,然后用bufB调用wxBitmap对象的构造函数。其实核心问题就在这里:wxBitmap对象并不接受BMP的文件格式的buffer,而只接受XBM格式的buffer。 建议你先把 http://trac.wxwidgets.org/browser/wxWidgets/trunk/samples/drawing/drawing.cpp 这个例子吃透。 但是XBM只运行单色的(即只支持黑白)的图片,而实际上采集的图片是彩色的。虽然wxBitmap有一个构造函数的形式是: wxBitmap (const ...
by nalisaki
Mon Mar 26, 2012 2:51 am
Forum: C++ Development
Topic: how to display a bitmap in wxStaticBitmap?
Replies: 13
Views: 5367

Re: how to display a bitmap in wxStaticBitmap?

I still don't know what the program flow of your code is. All i can say is: If capturing the images happens inside a closed loop through a callback, so that the wxWidgets event loop has no chance to do its job, you have a problem. You can try calling wxGetApp().Yield() whenever you change the wxSta...
by nalisaki
Sun Mar 25, 2012 12:00 pm
Forum: C++ Development
Topic: how to display a bitmap in wxStaticBitmap?
Replies: 13
Views: 5367

Re: how to display a bitmap in wxStaticBitmap?

The code has become very unclear now. The thread seems to run for one iteration only? And why do you use WIn32 code to create the bitmap? Mab be you can call it a iteration.ShowBmp is called in a thread created in a EVT handler,and ShowFun is call in a thread created in ShowBmp. Isn't this right? U...
by nalisaki
Sun Mar 25, 2012 6:18 am
Forum: wxWidgets Development (Chinese)
Topic: 用wxStaticBitmap控件显示从网络摄像头获取的数据
Replies: 4
Views: 5430

Re: 用wxStaticBitmap控件显示从网络摄像头获取的数据

1)显示动态图像不宜使用wxStaticBitmap控件,如你在注释掉的代码中尝试的,使用wxDC来DrawBitmap更为可行;建议还是从这个角度开始尝试,从成功显示一个图片开始; 2)回调的事件本身就在单独的EventLoop线程中处理,你创建一个线程并等其join,其实是多此一举,没用线程之时也显示不出来肯定是因为别的原因,这个方向走错了;建议去掉所有线程相关的部分; 3)从你的示例代码中看不出图像采集后如何触发显示的事件,不好判断为什么没有显示图像; 4)wxWidgets本身是一个跨平台的C++库,可是从你的代码中却看到pthread这样平台相关的调用,也看到malloc、void...
by nalisaki
Sat Mar 24, 2012 8:23 am
Forum: wxWidgets Development (Chinese)
Topic: 用wxStaticBitmap控件显示从网络摄像头获取的数据
Replies: 4
Views: 5430

用wxStaticBitmap控件显示从网络摄像头获取的数据

现在已可以从网络摄像头获取数据并把数据转换为.bmp文件,想在wxwidget中的wxStaticBitmap控件中进行显示,当然是用控件显示,因为,会一直不停地从网络摄像头中获取数据并显示,这也是自己想做成的效果。现在的做法是,把一个回调函数传给采集图像的函数,我在这个回调函数中进行了一些显示图像的操作,但图像并没有显示出来,不知道是什么原因。个人感觉好像是一些事件没被触发一样。 因为在采集图像的函数中包含一个死循环,我做的一个示例的流程是: 当点击采集按钮时,在其事件响应中新建一个线程1,在线程1中调用彩集图像的函数,这样,图像就可以一直采集了。 在回调函数中,创建线程2,在线程2中进行图...
by nalisaki
Sat Mar 24, 2012 6:56 am
Forum: C++ Development
Topic: how to display a bitmap in wxStaticBitmap?
Replies: 13
Views: 5367

Re: how to display a bitmap in wxStaticBitmap?

I still cann't get it to work, the problem is: the program flow is ok, the data pImgFr gotten from a getBmpData is ok, but the user interface is never updated. May be PB has meant to it : the GUI operation shoud be done in the main thread. Is That the case? the important part of my source code(c++) ...
by nalisaki
Fri Mar 23, 2012 10:06 am
Forum: C++ Development
Topic: how to display a bitmap in wxStaticBitmap?
Replies: 13
Views: 5367

Re: how to display a bitmap in wxStaticBitmap?

To PB,doublemax and Youka, thanks for your great idea. I will try them later. I have tried using a mutex to control the interface updateing and the getBmpData thread. Disppointingly, it doesn't work well. BTW, I get webcam data from v4l2 driver. There is example in file capture.c. If some one is int...