Active Topics

 


Reply
Thread Tools
Posts: 61 | Thanked: 77 times | Joined on Dec 2009 @ Lancaster
#1
Hello,

Just to make life easier to anyone who wants to do AR on N900 i have a few suggestions.

1.) Use openCV library for any tracking and image manipulation. It is an amazing library that is available in the repo.

M900:

$ apt-get install libcv4 libcvaux4 libhighgui4

Scratchbox:

$ apt-get install libcv4 libcv-dev opencv-doc libcvaux-dev libcvaux4 python-opencv libhighgui-dev libhighgui4

2.) For capturing video use openCV library calls or go through the hassle of GStreamer (appsink element) which can be integrated with QT using QGLWidget object. I attached source code of a project GstOpenGL that demonstrates how this can be done. Make sure you have qt 4.6 on your N900 or scratchbox. The GstOoenGL does not use openCV.

The code has not been cleaned and optimized but should save you time.
Klen
Attached Files
File Type: tar GstOpenGL_V1.tar (430.0 KB, 927 views)

Last edited by klen; 2010-06-02 at 11:15.
 

The Following 4 Users Say Thank You to klen For This Useful Post:
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#2
thanks Klen, very helpful.
would be nice if you have the link to the doxygen or details of api's.
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

“I hear and I forget. I see and I remember. I do and I understand.”
 
Posts: 8 | Thanked: 1 time | Joined on May 2010
#3
a) Thank you very much, Klen.

b) krk969: Do you mean http://opencv.willowgarage.com/docum...cpp/index.html ? I also read parts of "Learning OpenCV: Computer Vision with the OpenCV Library", which seemed quite helpful.

The conventional resources are:
http://doc.qt.nokia.com/qt-maemo-4.6/classes.html
http://www.khronos.org/opengles/sdk/docs/man/
http://gstreamer.freedesktop.org/documentation/

Hope that helps. Since the main code chunks are taken from the tutorials and contain no doxygen documentation themselves, there shouldn't be any further resources imho.

Last edited by Dorfmeister; 2010-06-07 at 07:14.
 
Posts: 8 | Thanked: 1 time | Joined on May 2010
#4
If I open the .pro file via left click in Qt Creator, this happens:
build results in an error, so I have to qmake
then I get 22 errors with "gl* (glVertexAttribPointer etc.) was not declared" if I build or "gst/interfaces/photography.h: No such file or directory" if I rebuild

If I delete everything, unzip it again, open QtCreator manually and load the same .pro file via menu, it buils just fine, but if I change it into a format to be able to generate a Debian package easily later on I get "No rule to make target 'texture.qrc'"

Could anybody help me with this please? I seem not to be sufficiently familiar with qmake.

Oh - if I try to run it using MADDE (which again works fine with other programs), I get:
Code:
Files to deploy: /scratchbox/users/maemo/home/maemo/OwnProjects/AWESOME/DistanceQT-build/DistanceQT.
Deployment finished.
Starting remote application.
chmod u+x /home/developer/DistanceQT; source /etc/profile;  /h ome/developer/DistanceQT  
Pipline initialized! 
GST error: v4l2camsrc_calls.c(686): gst_v4l2camsrc_open (): /GstPipeline:test-camera/GstV4l2CamSrc:camera_src: 
system error: Permission denied 
Aborted
Since this is for educational purposes: Could anybody show how to integrate OpenCV? That would be awesome. Developing for the N900 is really cumbersome. I've been looking into it for weeks now and I'm still struggling with beginner mistakes, whereas I could already have written a whole enterprise application for Android in the same time.

If I build another modification compilation works, but I get a
Code:
/scratchbox/tools/bin/misc_runner: /targets/links/scratchbox.config: No such file or directory
if I try to run it via ssh. And we're talking about minor changes - changing some array values. Why does so much happen if I don't really change anything?!

Btw: I use Qt 4.6.2 instead of 4.5. If there are any cleaned up versions, fixes for my problems, updates etc please let me know.

Best regards,
Dorfmeister

Last edited by Dorfmeister; 2010-06-07 at 07:11.
 
Posts: 8 | Thanked: 1 time | Joined on May 2010
#5
Hi,

I solved the issues (thanks, Klen) and now try to include OpenCV support. I installed the packages recommended by Klen and tried a test pipeline using gst-launch (based on http://vimeo.com/6866036):
Code:
gst-launch v4l2camsrc device=/dev/video0 ! video/x-raw-yuv,width=480,height=272 ! videorate ! capsfilter caps="video/x-raw-yuv,width=480,height=272,framerate=(fraction)12/1" ! queue ! ffmpegcolorspace ! faceblur ! ffmpegcolorspace ! xvimagesink
However, this results in
Code:
WARNING: erroneus pipeline: no element "faceblur"
, which is the only OpenCV component. Without it, the test runs fine. Has anybody working CV support? Could anybody post a minimal example or tell me how to make it run? If we want great CV apps for our N900 we should provide beginners with a solid starting point for OpenCV as well.

Thanks in advance.

EDIT:
There are simply no OpenCV-GStreamer plugins available according to Daniil (thanks!), which is the reason why the pipeline doesn't work.

I wrote a short example for using OpenCV myself, see here:
http://discussion.forum.nokia.com/fo...-in-Qt-example


Best regards,
Dorfmeister

Last edited by Dorfmeister; 2010-06-11 at 02:39.
 
Posts: 61 | Thanked: 77 times | Joined on Dec 2009 @ Lancaster
#6
Originally Posted by Dorfmeister View Post
Hi,
EDIT:
There are simply no OpenCV-GStreamer plugins available according to Daniil (thanks!), which is the reason why the pipeline doesn't work.
Dorfmeister
This is true, but the way you can intergrate gstreamer with OpenCV is to parse the captured raw image data into the IplImage object of the OpenCV Library.

The way to do this:
1.) create an IplImage object of the right size and format.
HTML Code:
IplImage *frame;
frame = cvCreateImageHeader(cvSize(CameraN900::buffer_width,CameraN900::buffer_hight), IPL_DEPTH_8U, 3);
2.) set the data part of the IplImage object.
HTML Code:
cvSetData(tracker->frame ,data,CameraN900::buffer_width*3);
3.) As the captured data is in RGB format and the openCV is in BGR this conversion is needed.
HTML Code:
cvResize(tracker->frame,tracker->frameBGR);
4.) Now you are ready to use your captured frame with any openCV function.

The other way to go is to compleatly skip the QT and work with OpenCV only. You have all the functions that you need for displaying the and capturing the video stream. And the run fast but did not compare them with this approach. I guess if you don't need QT integration this is the way to go.

Sorry for the late reply. I think I was not subscribed to this thread.

I hope this helps.

Cheers,
Klen

Last edited by klen; 2010-08-27 at 09:48.
 
Posts: 7 | Thanked: 3 times | Joined on Jan 2009
#7
There are OpenCV-GStreamer plugins in the repository, Gst-Opencv


http://maemo.org/packages/view/gst-opencv/
 
Reply


 
Forum Jump


All times are GMT. The time now is 10:15.