Hi Thanks again Mr. Coding Train I'm learning a lot from these Processing tutorials. Around 3:26 you mention that your camera is doing "auto white balancing" and that there may be a way to fix this? I have an 8MP ELP HD USB camera I've just bought and I'm trying to get working for my project. There are no buttons on the camera and this camera uses the generic HD USB Camera driver (Here on Windows 10). Is there ANY way I can switch off auto white balance and auto exposure from within my Processing code? It's pretty fundamental to my project this, hope anyone out there can help, thanks. Chris
Fascinating topic. I suppose if a speed improvement is needed you could scale down the image (say 1/4 size) or loop through the pixels in steps of 4 for X and Y. At the risk of losing some of the resolution though.
i tried so hard to make opencv work in anyway when battlefield 3 came out maybe months. clearly had no clue what i was doing. lol extremely interesting when one of these mysteries of the past get solved
Hey, I have been trying to adapt that example to a Raspberry Pi, however, I keep getting errors like "ArrayOutOfBoundsException" here "color currentColor = video.pixels[loc];". It would be highly appreciable if you could help me with that. Thank you.
Yo coding train, I got an question, I am developing an vision system for the first robotics competition, is there any way I can color the pixels of our target and track a target?
Can you upload a p5.js version? Or either link me to a good resource? I'm tracking to transfer this code over but I'm running into trouble assigning the currentColor variable.
Is it possible to make the code so that it automatically tracks the reddest colour, without the mousePressed? I have been trying for a quite a while now to make it start that up automatically, but with no luck
I built this with python but cdist (for the color-distance) is really slow. What am I doing wrong? Takes 0,3 seconds for all pixels in one frame (640x480)
When I was trying it out it said "No library found for processing.video Libraries must be installed in a folder named 'libraries' inside the sketchbook folder (see the Preferences window)" would you know how I could fix this? thank you so much!
would the solution for it including your lips and other red pixels be to add a distance threshold in your if statement. so if the x,y point captured is much further than the previous x,y pixel its should be disqualified so it's stays at the red cup.
why do I have this error? "A library relies on native code that's not available. Or only works properly when the sketch is run as a 32-bit application. Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help → Troubleshooting." on the String[] cameras = Capture.list(); code
i just copied the code (for a schoolproject) and when i press on run, is says that "The import processing.video cannot be resolved" and that there is no library found for processing.video. What did i do wrong? what do i have to do?
I don't understand that formula (x+y*width). I'm new to c but when i search through a 2d array i type in array[x][y] and this seems to make sense to me. in your case i dont see how that formula gets the grid you want.
ahh.. I see I should be watching this videos in order then(haha). sorry I just subscribed recently and everytime a video shows up I just watch it hoping i'll understand. I'm trying to learn C and python but only to use it in softwares that I work with. So the aspects of draw and pixels don't really matter for me but I try to understand the code. Thank you
In processing the pixel array is a simple array ( like lists in py ). It would make sense to have an array of arrays for better understanding, but it's slower.
Hey there..i'm trying to link my arduino with vision processing ...CAN U PLEASE!!!do some videos on communicating The Arduino with processing3??? (gosh..I've Posted this everywhere! :p)
My question is very off topic, but can you try to programm a method that randomizes stuff from scratch? I've always asked myself how it's possible to even get a random number and you seem to know some stuff ;) Maybe this task is too big, maybe its too easy I dont even know... Greetings from Germany!
Why dont you track the position between the last average and the new found redish pixels and value them, so the nearer get a higher value so then you dont get red on your skin/lips mixed with the red cup
Very good demonstation. I 've problem with hypermedia.video. "No library found for hypermedia.video Libraries must be installed in a folder named 'libraries' inside the sketchbook folder (see the Preferences window)" How should i solve this issue? I use processing 3x and i tried with processing 2x still doesn't work. import hypermedia.video.*; import java.awt.*; import processing.serial.*; OpenCV opencv; // contrast/brightness values int contrast_value = 0; int brightness_value = 0; Serial port; // track the current servo for control, position, and default positions. char servoTiltPosition = 90; char servoPanPosition = 90; char tiltChannel = 0; char panChannel = 1; // the x,y coordinates of the middle of the face. int midFaceY = 0; int midFaceX = 0; // define the center of the screen. int midScreenY = (height/2); int midScreenX = (width/2); int midScreenWindow = 10; //error margin for centering. int stepSize = 1; //degree of change per iteration. Rectangle[] faces; void setup() { size( 320, 240 ); opencv = new OpenCV( this ); opencv.capture( width, height ); // open video stream opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT ); // load detection description, here-> front face detection : "haarcascade_frontalface_alt.xml" // print usage println(Serial.list()); // reveals which com teh arduino is on. port = new Serial(this, Serial.list()[0], 57600); // set baud rate to match arduino. println( "Drag mouse on X-axis inside this sketch window to change contrast" ); println( "Drag mouse on Y-axis inside this sketch window to change brightness" ); // send the initial angles to the Arduino. port.write(tiltChannel); // set tilt servo ID port.write(servoTiltPosition); // sends tilt angle port.write(panChannel); // set pan servo ID port.write(servoPanPosition); // sends pan angle } public void stop() { opencv.stop(); super.stop(); } void draw() { // grab a new frame, convert to gray opencv.read(); opencv.convert( GRAY ); opencv.contrast( contrast_value ); opencv.brightness( brightness_value ); //display image image( opencv.image(), 0, 0 ); // proceed detection faces = opencv.detect( 1.2, 2, OpenCV.HAAR_DO_CANNY_PRUNING, 40, 40 ); // draw face area(s) noFill(); stroke(255,0,0); for( int i=0; i 0) { //If a face was found, find the midpoint of the first face in the frame. //NOTE: .x and .y of the face rectangle corresponds to the UPPER LEFT corner of the rectangle, //so they are adjusted to find the true midpoint. midFaceY = faces[0].y + (faces[0].height/2); midFaceX = faces[0].x + (faces[0].width/2); //Find out if the Y component of the face is below the midpoint if(midFaceY < (midScreenY - midScreenWindow)){ if(servoTiltPosition >= 5)servoTiltPosition -= stepSize; //If it is below the middle of the screen, update teh tilt positions variable to lower the tilt servo. } //Find out if the Y component of the face is above the midpoint. else if(midFaceY > (midScreenY + midScreenWindow)){ if(servoTiltPosition = 5)servoPanPosition -= stepSize; //Update the pan position to move the servo to teh left. } //Find out if the X component of the face is to the right of the midpoint. else if(midFaceX > midScreenX + midScreenWindow){ if(servoPanPosition
This video uses Processing (which is built on top of the Java programming language). For more info, visit processing.org and also this video might help th-cam.com/video/AmlAiKsiy0o/w-d-xo.html.
"Please don't be like me. Live your life with spaces in weird places." Daniel Shifman - 2016 4:32 Words to love and live by.
+Ben Miles haha. I need to make a tshirt with this I think.
I’ve stopped binge watching Netflix, too busy binge watching The Coding Train
You deserve more subscribers!! You make verry good video's that are interesting to watch! keep it up!!
Greetings from the Netherlands!!
thanks, so glad to hear!
Ook de groeten van mij 😎
i think you are the best person ever been on youtube buddy , you are creating awesome vids keep up ;)
You can find the Golan Levin article here ->
www.yorku.ca/caitlin/futurecinemas/resources/coursepack/readings/computervision
Yes! I am so excited for this series!
glad to hear!
can we go for a few beers and talk about coding? Great Video!!
Hi Thanks again Mr. Coding Train I'm learning a lot from these Processing tutorials. Around 3:26 you mention that your camera is doing "auto white balancing" and that there may be a way to fix this? I have an 8MP ELP HD USB camera I've just bought and I'm trying to get working for my project. There are no buttons on the camera and this camera uses the generic HD USB Camera driver (Here on Windows 10). Is there ANY way I can switch off auto white balance and auto exposure from within my Processing code? It's pretty fundamental to my project this, hope anyone out there can help, thanks. Chris
Great video on a really cool topic, can't wait for the next one :) ( Btw the numbers of the videos about computer vision seems messed up )
Thanks I'm hoping to revise / revisit the numbering system for all the videos at some point.
Fascinating topic. I suppose if a speed improvement is needed you could scale down the image (say 1/4 size) or loop through the pixels in steps of 4 for X and Y. At the risk of losing some of the resolution though.
+config2000 this is a great tip yes!
brilliant, thank you very much! I LEARNED A LOT!
Thanks gave me an idea
i tried so hard to make opencv work in anyway when battlefield 3 came out maybe months. clearly had no clue what i was doing. lol extremely interesting when one of these mysteries of the past get solved
Do you have any recommendations for good cameras for installations and other art projects using computer vision?
I used to love the PS Eye but it doesn't work with the mac anymore. The kinect is great for depth sensing.
Do you sell software clones of yourself that will point at bits of code and answer my questions? :D
I wish!
#SpacesInWeirdPlaces.
Hello Daniel,
Loving the way you teach,
Is it possible to port the above code using **processing.js**
Yes, this code can work in JS also. I'm not sure if processing.js supports camera input, but p5.js does.
Hey, I have been trying to adapt that example to a Raspberry Pi, however, I keep getting errors like "ArrayOutOfBoundsException" here "color currentColor = video.pixels[loc];". It would be highly appreciable if you could help me with that. Thank you.
Yo coding train, I got an question, I am developing an vision system for the first robotics competition, is there any way I can color the pixels of our target and track a target?
And if the target moves it changes a bit of color, I am now using exact 1 color is there an way I can set a target between two colors in?
Can you upload a p5.js version? Or either link me to a good resource? I'm tracking to transfer this code over but I'm running into trouble assigning the currentColor variable.
Is it possible to make the code so that it automatically tracks the reddest colour, without the mousePressed?
I have been trying for a quite a while now to make it start that up automatically, but with no luck
Start with color(255,0,0) as trackColor!
I built this with python but cdist (for the color-distance) is really slow. What am I doing wrong? Takes 0,3 seconds for all pixels in one frame (640x480)
hi! what should i install with visual studio to do this tutorial ?
Please! If i want to send the X and Y position of color to OSC, how i can do ?
When I was trying it out it said "No library found for processing.video
Libraries must be installed in a folder named 'libraries' inside the sketchbook folder (see the Preferences window)" would you know how I could fix this? thank you so much!
Go to Sketch-->Import-->Add Library
@@TheCodingTrain thank you! :)
Great job! :D
would the solution for it including your lips and other red pixels be to add a distance threshold in your if statement. so if the x,y point captured is much further than the previous x,y pixel its should be disqualified so it's stays at the red cup.
+MrBrN197 yes indeed! You'll see this in my video release this coming Thursday.
why do I have this error?
"A library relies on native code that's not available.
Or only works properly when the sketch is run as a 32-bit application.
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help → Troubleshooting."
on the
String[] cameras = Capture.list();
code
You need to download the processing video library to get access to live videos/movie files. Here's how th-cam.com/video/WH31daSj4nc/w-d-xo.html
Is there a p5 equivalent of this video somewhere?
that was like the trick when some body pulls their thumb off and puts it back on. OO what a freakish thing with those space actually working.
i just copied the code (for a schoolproject) and when i press on run, is says that "The import processing.video cannot be resolved" and that there is no library found for processing.video.
What did i do wrong? what do i have to do?
Can you ask this at forum.processing.org? It's easier for me and others to help that way (you can share code there easily!).
where is the code?
Hi! Where is the code??
I don't understand that formula (x+y*width). I'm new to c but when i search through a 2d array i type in array[x][y] and this seems to make sense to me. in your case i dont see how that formula gets the grid you want.
This is explained further in this video: th-cam.com/video/EmtU0eloTlE/w-d-xo.html
ahh.. I see I should be watching this videos in order then(haha). sorry I just subscribed recently and everytime a video shows up I just watch it hoping i'll understand. I'm trying to learn C and python but only to use it in softwares that I work with. So the aspects of draw and pixels don't really matter for me but I try to understand the code. Thank you
In processing the pixel array is a simple array ( like lists in py ). It would make sense to have an array of arrays for better understanding, but it's slower.
Hey there..i'm trying to link my arduino with vision processing ...CAN U PLEASE!!!do some videos on communicating The Arduino with processing3??? (gosh..I've Posted this everywhere! :p)
I need to do this with javascript but with images not video anyhelp?
how I find the Code ?
My question is very off topic, but can you try to programm a method that randomizes stuff from scratch?
I've always asked myself how it's possible to even get a random number and you seem to know some stuff ;)
Maybe this task is too big, maybe its too easy I dont even know... Greetings from Germany!
Sure! Suggest here: github.com/CodingRainbow/Rainbow-Topics/issues
could i do this with opencv ,or is it harder ?
Why dont you track the position between the last average and the new found redish pixels and value them, so the nearer get a higher value so then you dont get red on your skin/lips mixed with the red cup
This is an excellent idea!
alguien que tenga el link o sepa donde esta el link para descargar el codigo ?????????????????????
Golan Levin link doesn't exist anymore :(
Very good demonstation.
I 've problem with hypermedia.video.
"No library found for hypermedia.video
Libraries must be installed in a folder named 'libraries' inside the sketchbook folder (see the Preferences window)"
How should i solve this issue?
I use processing 3x
and i tried with processing 2x still doesn't work.
import hypermedia.video.*;
import java.awt.*;
import processing.serial.*;
OpenCV opencv;
// contrast/brightness values
int contrast_value = 0;
int brightness_value = 0;
Serial port;
// track the current servo for control, position, and default positions.
char servoTiltPosition = 90;
char servoPanPosition = 90;
char tiltChannel = 0;
char panChannel = 1;
// the x,y coordinates of the middle of the face.
int midFaceY = 0;
int midFaceX = 0;
// define the center of the screen.
int midScreenY = (height/2);
int midScreenX = (width/2);
int midScreenWindow = 10; //error margin for centering.
int stepSize = 1; //degree of change per iteration.
Rectangle[] faces;
void setup() {
size( 320, 240 );
opencv = new OpenCV( this );
opencv.capture( width, height ); // open video stream
opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT ); // load detection description, here-> front face detection : "haarcascade_frontalface_alt.xml"
// print usage
println(Serial.list()); // reveals which com teh arduino is on.
port = new Serial(this, Serial.list()[0], 57600); // set baud rate to match arduino.
println( "Drag mouse on X-axis inside this sketch window to change contrast" );
println( "Drag mouse on Y-axis inside this sketch window to change brightness" );
// send the initial angles to the Arduino.
port.write(tiltChannel); // set tilt servo ID
port.write(servoTiltPosition); // sends tilt angle
port.write(panChannel); // set pan servo ID
port.write(servoPanPosition); // sends pan angle
}
public void stop() {
opencv.stop();
super.stop();
}
void draw() {
// grab a new frame, convert to gray
opencv.read();
opencv.convert( GRAY );
opencv.contrast( contrast_value );
opencv.brightness( brightness_value );
//display image
image( opencv.image(), 0, 0 );
// proceed detection
faces = opencv.detect( 1.2, 2, OpenCV.HAAR_DO_CANNY_PRUNING, 40, 40 );
// draw face area(s)
noFill();
stroke(255,0,0);
for( int i=0; i 0)
{
//If a face was found, find the midpoint of the first face in the frame.
//NOTE: .x and .y of the face rectangle corresponds to the UPPER LEFT corner of the rectangle,
//so they are adjusted to find the true midpoint.
midFaceY = faces[0].y + (faces[0].height/2);
midFaceX = faces[0].x + (faces[0].width/2);
//Find out if the Y component of the face is below the midpoint
if(midFaceY < (midScreenY - midScreenWindow)){
if(servoTiltPosition >= 5)servoTiltPosition -= stepSize; //If it is below the middle of the screen, update teh tilt positions variable to lower the tilt servo.
}
//Find out if the Y component of the face is above the midpoint.
else if(midFaceY > (midScreenY + midScreenWindow)){
if(servoTiltPosition = 5)servoPanPosition -= stepSize; //Update the pan position to move the servo to teh left.
}
//Find out if the X component of the face is to the right of the midpoint.
else if(midFaceX > midScreenX + midScreenWindow){
if(servoPanPosition
This code i coppy from
th-cam.com/video/0fBA_kkc-qE/w-d-xo.html
i can't run the code, because I don't know wich libraries you're using...
This video uses Processing (which is built on top of the Java programming language). For more info, visit processing.org and also this video might help th-cam.com/video/AmlAiKsiy0o/w-d-xo.html.
Excuse me where is the program??? I need it 🥺
si encontraste el programa ?
Yesssss
I dont how to back the color of this mobile
I also want to know
would you like to be lecturer in my college? :)))) luv ur vids!! subs for sure
please clic clic on your green background!
Could you pass me the code Is for a task :( +The Coding Train
Miguel Pech you can download it
Loving the gay background :P
Urm what was that? 5:11
some throttling stuff I guess