I have a question on the Raspberry Pi cam. I am using openCV on a raspberry Pi 2 to make a line-follower for a robot.
Basically the idea is to find the direction of a line in the image using derivatives and color segmentation.
However, I'm found some strange behaviour when I compare the results on an ordinary PC webcamera and the picam. The algorithm works well on the PC webcam, and the direction indicator sits spot on the line. On the picam there is a strange scale and offset which I don't understand.
On both platforms I have tried both the cap.set(CV_CAP_PROP_FRAME_WIDTH/HEIGHT) to rescale the image, as well as the resize function. Both of them still produce the strange offset. I use the circle(...) and line(...) methods in openCV to overlay the line and circles on the captured image.
Could anyone help to explain this behaviour? See the links below for a visual caption.
picam
webcam
Regards
I couldn't add the pictures directly because of the policies of Stackexchange, so had to provide links instead.
I eventually discovered the solution to the problem, and it involved changing the order of the taps of a derivative filter for the Windows and Linux versions of the program. Exactely why this is the case is a mystery to me, and may involve differences in compiler optimization (Visual Studio 13 vs g++ 4.6.3), or maybe a silly error on my part.
On the the PC I use {1 0 -1} filter taps, on the RP2 I have to use {-1 0 1} instead.
The filter runs on a S8 (-127..127) image, so there is no issue of a wraparound.
At any rate, I consider the issue closed.
Related
I'm having an issue with my GigE camera whenever I'm doing image acquisition with MATLAB IMAQ. It is clearly connected as indicated by the gigecamlist and gigecam function calls, but the issue is I'm always having black images or you can say no image at all. I figured it might be an issue of the frame size.Also, my network adapter doesn't provide the option of choosing jumbo frames, so I'm not sure what I can do about it now. The camera model under question is JAI Pulnix 1405-GE and I'm using MATLAB 2014b.
If any of you have any clue about what the problem might be, please share it with me. If you can give me some clue about what I can do solve this issue, it will be much appreciated.
Thank you
Did you try the JAI SDK software to see if the camera works properly?
Once you are sure about it working, copy the parameters shown in JAI SDK to your Matlab camera object.
On a side note, GigE cameras work better with Labview.
Does anybody know what the fastest processing times are for the beaglebome black and the RaspberryPi. By processing time, i refer to reading a really fast input signal across any two of their input pins.
Context:
I am building a small particle detector and the pmt output, which i will connect directly to the beaglebone black or a RasberryPi for processing, is 3.3V and ~40ns wide. I am concerned whether these signals will be too fast for these micro-computers to even detect it. And i cant seem to find that info anywhere.
Thanks in advance.
Beaglebone black has programmable realtime units (PRU) that run at 200 MHz (5ns per instruction). With these you will be able to reliably detect and count pulses >=15ns wide that are at least 30ns or so apart.
See this presentation. It's really quite awesome: http://beagleboard.org/pru
Raspberry Pi doesn't have anything similar with real time/reliability guarantees. I don't know whether or not there's a clever way you could get it to do what you want.
I wrote some code at home to plot some 3D-data. It worked fine. Now I ran the same code at the office and I got some weird bug. It seems that there is a label for each data point inserted.
But this only happens on half of the plots. The left plot shows the real data and the right one is just a smoothed fit of this data. The left one gets the error and the right one doesn't.
I ran the code on the machine of a colleague and it worked fine too. So I saved the clean figure files on his machine and tried to open them on my PC. Still the same bug. So it's not the code but seems to be some weird displaying bug.
Did anyone see this before?
figure(1);
s1=gca;
surf(t_matrix,f_matrix,alpha_matrix)
colorbar
figure(2);
s2=gca;
surf(t_matrix2,f_matrix2,alpha_matrix2)
colorbar
It's just this code. And if I debug, the numbers appear after the first call to colorbar. But not in the second case. My Matlab version at home is 2013a, but at the office and that from my colleague are both 2012b.
This seems to be a bug. There is a thread on MATLAB Answers.
The accepted answer there by Jan Simon is
This could be cause by the OpenGL driver. Did you install the newest
drivers of your graphics cards?
Workaround might be:
set(gcf, 'renderer', 'zbuffer');
or if OpenGL looks nicer:
opengl software
or perhaps:
opengl hardware
Look for "OpenGL" in the documentation to find a bunch of switches to
consider a bunch of driver bugs.
Actually the zbuffer renderer works fine but is not enough in some cases.
I often use to work with transparent surface plot using the gca property facealpha set to 0.5 in order to superpose a contour plot to it. Face or edge alpha settings (maybe some other plot properties) are only correctly displayed with the Opengl renderer. The zbuffer cannot picture transparent surface plot.
The main issue first came to my attention when I recently switched to Win8. Bloody $Bill 'HamsterWhy' Gate.
A patch from Mathworks would be greatly appreciated.
I am working on a project where I have to render 4 different sides of a 3D object at the same time on the screen. The output should have 4 different camera outputs rendering the front side, left side, right side and back side of the 3d object.
I found that a gaming engine like Unity may help to do something like this. However, I have just started using Unity and can't figure out how to do it.
Here is the link for some examples. This is how I want the output to look like
Well first of all, welcome to Stackoverflow. And you are right, Unity is an excellent IDE to achieve what you described.
As stated in the FAQ and here, I'm going to give you an answer I deem fitting to your question. I can post the code here in about 30 minutes which does exactly what you asked for, but then we'd miss the point of learning to program and posting at StackOverflow in general. I'll show you the way on how to start on this project, but then you'll have to try yourself. If you have any troubles after trying some more, we can help you with specific problems, provided you have researched some before and show us what you tried.
As to your question, it's relative easy to do so. First create your object in the scene, then drag and place four different Camera-objects in the screen. Using the Camera's Normalized View Port Rect (Four values that indicate where on the screen this camera view will be drawn, in Screen Coordinates (values 0-1)), you can then split up the view to show the feed of each Camera.
This ofcourse happens in a script. You can read here about Scripting in Unity. Even if you are an expert in programming, that link is worth a read when you are new to Unity.
Good luck.
See the picture below. It's a flash game from a well known website :)
http://imageshack.us/photo/my-images/837/poolu.jpg/
I'd like to capture the images, frame by frame, using Matlab, and then lenghten the line that goes from the 8 ball, the short one, so i can see exactly where it will go. And display another window, in which the exact pool table will appear but with longer lines for the paths :)
I know, or can easily find out, how to capture the screen and whatnot, the problem is that i'm not sure how to start detecting those lines, to see the direction they are heading towards. Can anyone suggest an idea on how to accomplish this? Any image processing techniques i could use to at least filter out everything except those lines.
Not sure where to even start looking, or for WHAT.
And yeah, it's a cheat i know. But i got programming skills, why not put them in practice? :D Help me out people, it's a fun project :)
Thanks.
I would try using the Hough transform in the Matlab Image Processing Toolbox.
EDIT1:
Basically the Hough transform is a technique for detecting linear structures (lines) in an image.