Converting rgb data to cv2 image
up vote
-3
down vote
favorite
I'm trying to use Webots simulator for simulation of the autonomous vehicle. Currently, in order to find the position of the vehicle I need to detect the lanes. To do so, I'm using an algorithm based on the open CV in python and its code loads an existing image by imread to find the lanes. From the webots camera I can get the rgb array but saving the image and reading the saved image is not real time. I need to create the object which has all features of an object created by imread. I think there should be a more fast way to do so but I don't have any experience in image processing!
I have used following to get the camera data:
from vehicle import Driver
import main as LD
camera = driver.getCamera("camera")
camera.enable(20)
camera.recognitionEnable(50)
while driver.step() != -1:
distance = LD(camera.getImage)
In main, LD(imread('/path/to/image')) will return the distance of the car to the middle of the lanes. Based on the Webots documentation for a camera, the getImage returns an image coded as a sequence of three bytes representing the red, green and blue levels of a pixel. Pixels are stored in horizontal lines ranging from the top left-hand side of the image down to bottom right-hand side.
I'm so welcome to your suggestions.
opencv real-time rgb webots
add a comment |
up vote
-3
down vote
favorite
I'm trying to use Webots simulator for simulation of the autonomous vehicle. Currently, in order to find the position of the vehicle I need to detect the lanes. To do so, I'm using an algorithm based on the open CV in python and its code loads an existing image by imread to find the lanes. From the webots camera I can get the rgb array but saving the image and reading the saved image is not real time. I need to create the object which has all features of an object created by imread. I think there should be a more fast way to do so but I don't have any experience in image processing!
I have used following to get the camera data:
from vehicle import Driver
import main as LD
camera = driver.getCamera("camera")
camera.enable(20)
camera.recognitionEnable(50)
while driver.step() != -1:
distance = LD(camera.getImage)
In main, LD(imread('/path/to/image')) will return the distance of the car to the middle of the lanes. Based on the Webots documentation for a camera, the getImage returns an image coded as a sequence of three bytes representing the red, green and blue levels of a pixel. Pixels are stored in horizontal lines ranging from the top left-hand side of the image down to bottom right-hand side.
I'm so welcome to your suggestions.
opencv real-time rgb webots
So you have a 1D array, 2D array or a 3D array for the input image ?
– ZdaR
Nov 11 at 6:16
Please post a code example.
– Florian Echtler
Nov 11 at 8:07
@FlorianEchtler I have updated the question.
– Mojmal
Nov 12 at 17:25
@ZdaR The question has been updated.
– Mojmal
Nov 12 at 17:26
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
I'm trying to use Webots simulator for simulation of the autonomous vehicle. Currently, in order to find the position of the vehicle I need to detect the lanes. To do so, I'm using an algorithm based on the open CV in python and its code loads an existing image by imread to find the lanes. From the webots camera I can get the rgb array but saving the image and reading the saved image is not real time. I need to create the object which has all features of an object created by imread. I think there should be a more fast way to do so but I don't have any experience in image processing!
I have used following to get the camera data:
from vehicle import Driver
import main as LD
camera = driver.getCamera("camera")
camera.enable(20)
camera.recognitionEnable(50)
while driver.step() != -1:
distance = LD(camera.getImage)
In main, LD(imread('/path/to/image')) will return the distance of the car to the middle of the lanes. Based on the Webots documentation for a camera, the getImage returns an image coded as a sequence of three bytes representing the red, green and blue levels of a pixel. Pixels are stored in horizontal lines ranging from the top left-hand side of the image down to bottom right-hand side.
I'm so welcome to your suggestions.
opencv real-time rgb webots
I'm trying to use Webots simulator for simulation of the autonomous vehicle. Currently, in order to find the position of the vehicle I need to detect the lanes. To do so, I'm using an algorithm based on the open CV in python and its code loads an existing image by imread to find the lanes. From the webots camera I can get the rgb array but saving the image and reading the saved image is not real time. I need to create the object which has all features of an object created by imread. I think there should be a more fast way to do so but I don't have any experience in image processing!
I have used following to get the camera data:
from vehicle import Driver
import main as LD
camera = driver.getCamera("camera")
camera.enable(20)
camera.recognitionEnable(50)
while driver.step() != -1:
distance = LD(camera.getImage)
In main, LD(imread('/path/to/image')) will return the distance of the car to the middle of the lanes. Based on the Webots documentation for a camera, the getImage returns an image coded as a sequence of three bytes representing the red, green and blue levels of a pixel. Pixels are stored in horizontal lines ranging from the top left-hand side of the image down to bottom right-hand side.
I'm so welcome to your suggestions.
opencv real-time rgb webots
opencv real-time rgb webots
edited Nov 12 at 17:24
asked Nov 11 at 6:11
Mojmal
12
12
So you have a 1D array, 2D array or a 3D array for the input image ?
– ZdaR
Nov 11 at 6:16
Please post a code example.
– Florian Echtler
Nov 11 at 8:07
@FlorianEchtler I have updated the question.
– Mojmal
Nov 12 at 17:25
@ZdaR The question has been updated.
– Mojmal
Nov 12 at 17:26
add a comment |
So you have a 1D array, 2D array or a 3D array for the input image ?
– ZdaR
Nov 11 at 6:16
Please post a code example.
– Florian Echtler
Nov 11 at 8:07
@FlorianEchtler I have updated the question.
– Mojmal
Nov 12 at 17:25
@ZdaR The question has been updated.
– Mojmal
Nov 12 at 17:26
So you have a 1D array, 2D array or a 3D array for the input image ?
– ZdaR
Nov 11 at 6:16
So you have a 1D array, 2D array or a 3D array for the input image ?
– ZdaR
Nov 11 at 6:16
Please post a code example.
– Florian Echtler
Nov 11 at 8:07
Please post a code example.
– Florian Echtler
Nov 11 at 8:07
@FlorianEchtler I have updated the question.
– Mojmal
Nov 12 at 17:25
@FlorianEchtler I have updated the question.
– Mojmal
Nov 12 at 17:25
@ZdaR The question has been updated.
– Mojmal
Nov 12 at 17:26
@ZdaR The question has been updated.
– Mojmal
Nov 12 at 17:26
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246312%2fconverting-rgb-data-to-cv2-image%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
So you have a 1D array, 2D array or a 3D array for the input image ?
– ZdaR
Nov 11 at 6:16
Please post a code example.
– Florian Echtler
Nov 11 at 8:07
@FlorianEchtler I have updated the question.
– Mojmal
Nov 12 at 17:25
@ZdaR The question has been updated.
– Mojmal
Nov 12 at 17:26