I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from?

Added by Trong Dat Pham over 2 years ago

Hello,
I am performing a project. I want to research CMUCam4 modurn to apply it into my project. However, I don't know how to use it. Where should i begin? Could I use C programming language to program CMUCam4? I am working with windows operating system.
Are there imitative softwares or other ways that help me know the program i wrote is true or false?
My English is not very good, so I hope you forgive me. I am sorry because disturbing you. Looking forward to your answer. Thank for your help.


Replies (11)

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Kwabena Agyeman over 2 years ago

Hi,

The CMUcam4 is designed to be used with an Arduino microcontroller. What is it you'd like to do?

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Trong Dat Pham over 2 years ago

Do you have any guidelines about how to programming CMUCam4 in Arduino environment? I've read your instructions on the website:" http://cmucam.org/docs/cmucam4/arduino_api/ ", but I still do not know how to use CMUcam4 Arduino Interface Library. Is there any such article or specific programming moreinstructions? If I want to tracking a red ball, how can I do? How can follow that red ball? I'm doing a project on autonomous robot,how can it avoid obstacles?

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Trong Dat Pham over 2 years ago

2: How to read the image from the camera, image processing and image used to control the motor? (sorry because I use google translation)

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Kwabena Agyeman over 2 years ago

Hi, if you search through the forum what you want to know has likely already been answered. That said, check this thread out: http://www.cmucam.org/boards/7/topics/2313

Generally take a look at all the forum threads with longer than 10 posts.

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Kwabena Agyeman over 2 years ago

Hi, if you search through the forum what you want to know has likely already been answered. That said, check this thread out: http://www.cmucam.org/boards/7/topics/2313

Generally take a look at all the forum threads with longer than 10 posts.

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Trong Dat Pham over 2 years ago

I'm sorry 'cause bothering you again. I 've searched in forum for a while, but I can't find out the answer. how I have to use value "pixels" and "confidence" in pack "CMUcam4_tracking_data_t" to know exactly distance from object to camera ? can you write down a code to help me understand clearly ?

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Kwabena Agyeman over 2 years ago

Hi,

The pixels value just tells you how many pixels the camera sees. You can infer distance from the value but it isn't the distance. If you fix all the variables in your system (i.e. make the distant of the object to the camera the only thing that changes) then you can use the pixels value with a lookup table to get the distance. Basically, you write down each value of pixels you get for the object at a certain distance.

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Trong Dat Pham over 2 years ago

I am so sorry for annoying you again.
I am in a trouble that makes me not know how to handle.
So I greatly appreciate if you can help me.
I connect CMUcam4 to Mega Aruino as follows:
Connect Cam4’s TX0 to arduino’s RX3, Cam4’s RX1 to arduino’s TX3, they use the same GND, and CMUcam4 uses the power 5V of arduino.
My model is a red ball. It is at 20 cm distance from Cam4. Through CMUcam4GUI, I got the values of the model as follows:
Red Min=176,Red Max=218
Green Min=40,Green Max=122
Blue Min=72,Blue Max=111
Pixels=29.
I want to read the pixels value back to arduino and display via Serial Monitor
But I got very chaotic values as follows:
13 value 78 ( the value 78 appears most of my mock-up tests)
21 value 33
52 value 0
13 value 53
I want to ask you two questions:
1: why were the pixels values read so chaotic?
2: how do I know if CMUcam4 is communicating with arduino?
My code is as follows
#include <CMUcam4.h>
#include <CMUcom4.h>

int led=13;
//CMUcam4 cam;
CMUcam4 cam (CMUCOM4_SERIAL);

void setup() {
Serial.begin(115200);
cam.begin();
cam.autoGainControl(1);
cam.autoWhiteBalance(1);
cam.colorTracking(1);
cam.trackColor(176,218,40,122,72,111);
cam.noiseFilter(4);
pinMode(led,OUTPUT);

}
void loop() {
CMUcam4_tracking_data_t data;
cam.trackColor(176,218,40,122,72,111);
cam.getTypeTDataPacket(&data);
Serial.print(data.pixels);
Serial.print("\n");
if(data.pixels > 20) {
digitalWrite(led,HIGH);
}
else {
digitalWrite(led,LOW);
}
delay(1000);
}

IMAG2359.jpg (1.5 MB)

IMAG2360.jpg (1.3 MB)

IMAG2361.jpg (1.4 MB)

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Kwabena Agyeman over 2 years ago

Your program is printing out serial data on the same pins as it's communicating to the Arduino. You need to use a Arduino Mega or better if you want to print data while talking to the CMUcam4.

RE: I have a CMUCam4 modurn, but i don't know how to use it. Where must i start from? - Added by Kwabena Agyeman over 2 years ago

Please email me to continue this conversation - the forums auto email for me is not working anymore. I don't get notified when a new post is made anymore.

(1-11/11)