Hi,
I am having a problem using my Astra at 1280x960 resolution. I am using python with openni2 and opencv to get the image data. My code works fine with lower resolutions, however, I am getting a noisy output image at 1280x960 as shown in this thread: Astra cannot set 1280x960 resolution .
I have tried using a higher resolution of 1280x1024 as discussed here: 1280x960 color mode · Issue #32 · orbbec/ros_astra_camera · GitHub and have been able to get an image, however, I am now getting a Vsync issue where the image is “scrolling” down the screen. Can someone please tell me how to get a non noisy 1280x960 image, or alternatively a 1280x1024 image without vsync issues?
Regards,
Shawn
My code:
import numpy as np
import cv2
from primesense import openni2#, nite2
from primesense import _openni2 as c_api
Path of the OpenNI redistribution OpenNI2.so or OpenNI2.dll
Initialize openni and check
openni2.initialize(r"C:\Users\shawn\Desktop\OpenNI-Windows-x64-2.3\Redist") #
if (openni2.is_initialized()):
print (“openNI2 initialized”)
else:
print (“openNI2 not initialized”)
Register the device
dev = openni2.Device.open_any()
Create the streams stream
rgb_stream = dev.create_color_stream()
Check and configure the depth_stream – set automatically based on bus speed
print (‘The rgb video mode is’), rgb_stream.get_video_mode() # Checks rgb video configuration
rgb_stream.set_video_mode(c_api.OniVideoMode(pixelFormat=c_api.OniPixelFormat.ONI_PIXEL_FORMAT_RGB888, resolutionX=1280, resolutionY=960, fps=7))
Start the streams
rgb_stream.start()
Use ‘help’ to get more info
help(dev.set_image_registration_mode)
def get_rgb():
#bgr = np.fromstring(rgb_stream.read_frame().get_buffer_as_uint16(),dtype=np.uint8).reshape(960,1280,-1)
rgb = cv2.cvtColor(bgr,cv2.COLOR_BGR2RGB)
return rgb
main loop
s=0
done = False
while not done:
key = cv2.waitKey(1) & 255
## Read keystrokes
if key == 27: # terminate
print ("\tESC key detected!")
done = True
## Streams
#RGB
rgb = get_rgb()
## Display the stream syde-by-side
cv2.imshow('rgb', rgb)