I am connected to a ssh server using ssh -Y username@adress. On the server I run python2.7 using IDLE. If I use matplotlib I can see the outcome graphs on client. This suggests the graphical forwarding has no problem. However, when I am using OpenCV:
cv2.imshow('img_final', img_final)
cv2.waitKey(0)
cv2.destroyAllWindows()
It opens and show the image in the ssh server screen, not in the client ssh computer.
I did search and research, and in response of typical trobleshooting: - On my computer running client-ssh, echo $DISPLAY responds :0. It runs xterm. -On my server ssh computer, My sshd_config file seems to be ok (X11Forwarding yes). echo $DISPLAY shows localhost:10.0.
Moreover, I can use imageviewer such as 'feh' and shows images on client without any problem.
I do not think I have a configuration problem, because server is able to display graphics on client.
Is there a way to execute python scripts on server, and show outcome images from OpenCV directly on client (as MAtplotlib does) ?
Thanks
If it is of use to you, you could do something like a continuous capture but storing each frame as an image:
def deferred_init(self):
self.total_frames = 200
for i in range(self.total_frames):
self.stream = self.camera.capture_sequence(
['image%02d.jpg' % i]
)
return self.stream
(This snippet was in an object, hence the self.x) This is assuming you have camera = PiCamera and the usual initialization as well. Anyway, once called a) your working dir will be cluttered (recommend making writing to a different folder) and b) you can view your images from ssh with whatever you prefer. This way tests that a capture is working but also allows you to view from ssh.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With