2016-01-18 12:04:12 -0500 commented answer How to follow a line while moving in (x,y) plane? So the edge of the ROI is where the center of the camera needs to go? Indeed he needs to always centralize the camera on the line being followed. What about the phrase: " In my direction of travel I set a region (30 degrees) either side of that point and disregard anything outside of it." ? I'm trying to figure out from where to where is this region of 30 degrees, any ideas? 2016-01-18 07:15:21 -0500 commented answer How to follow a line while moving in (x,y) plane? "Question 1 - The vector holds sequential X,Y coordinates for the camera." If he wants to get the coordinates of the camera, he can simply read the central pixel of the image, since the camera is facing it. "Question 4 - There is a way to transform X,Y coordinates from the contour to camera coordinates and finally instructions to the motors." From my binary image, i can get the angle of orientation of the line segment, but that isn't enough to drive the motors, i need to decide which way i want to follow the line, CW or CCW, how can i do that? and how did he do that?! .. Any details are much appreciated. 2016-01-18 02:47:52 -0500 received badge ● Student (source) 2016-01-18 02:04:58 -0500 asked a question How to follow a line while moving in (x,y) plane? In short what i want is to follow a line like the guy in this video: https://www.youtube.com/watch?v=iHias... He talked a little bit about his algorithm in the description and in the comment section, but he wasn't that clear, since This type of following the line has great applications, i thought you guys might help me shed some light on it. In the video description he said: "The line intersects the roi and the vector is calculated" Question1: What vector he is talking about? a vector of what exactly? In the comment section he said: "I get the array of values from my ROI, one per degree. I then set a threshold level and turn these values into binary values. In my direction of travel I set a region (30 degrees) either side of that point and disregard anything outside of it. I find the centre value of the binary array representing line. This gives me an angle to drive to. I then turn this into a x and y velocity using sin cos functions. I feed the x any velocity into the stepper drives and the camera closes the loop." Question2: What values he is extracting from the ROI? and what does "one per degree" mean in this context Question3: Why would he need a threshold? isn't the image already binary? Question4: What direction of travel?, and what point? Question5: What does the center value of binary array mean?! Question6: How is he getting his angle of travel? As you guys see, i didn't understand a thing from his explanation? any help please. 2015-02-22 15:39:52 -0500 commented question Block process an image? @berak ,Your answer is perfect, it works for all image sizes, thank you! 2015-02-22 13:14:30 -0500 commented question Block process an image? @theodore, the number of rows of my image is primary, so the function is not working and asking for a different number of divisors, but i'm okay with a block that is smaller than the other, i can modify the algorithm to divide each image according to a different number, i need all my images to be divided into 16 tiles whether the tiles are even or not. 2015-02-21 15:01:15 -0500 received badge ● Editor (source) 2015-02-21 14:57:59 -0500 asked a question Block process an image? I want to : Read an image. Convert it to HSV and take only the Hue part. Divide the Hue plane into 16 blocks. Calculate for each block the Histogram and extract a feature based on it (maybe the dominant colour). Build a feature Vector. Compare the vector with itself. Untill now i'm stuck at dividing the image into 16 blocks. The divide section is actually diving my image into 25 blocks rather than 16. So how can i divide my image into 16 blocks and process each one of them? Code: #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include #include using namespace cv; using namespace std; int main() { cv::Mat src; /// Load image src = cv::imread( "path", 1 ); if( !src.data ) { std::cout << "image not found" << std::endl; return -1; } /// convert the image to HSV space cv::Mat hsv; cv::cvtColor( src, hsv, COLOR_BGR2HSV ); /// Separate the image in 3 places (H,S,V) cv::vector hsv_channels; cv::split( src, hsv_channels ); /// Take only the hue channel cv::Mat hue = hsv_channels[0]; /// divide into 16 blocks int tileHeight = hue.rows/4; int tileWidth = hue.cols/4; for (int r = 0; r < hue.rows; r += tileHeight) { for (int c = 0; c < hue.cols; c += tileWidth) { cv::Mat tile = hue(cv::Range(r, min(r + tileHeight, hue.rows)), cv::Range(c, min(c + tileWidth, hue.cols))); // tile processing here // ............. } } cv::waitKey(0); return 0 ; }