UDP Image Transfer - Raspberry Pi Forums
hi
i'm electronics engineer complete novice on raspberry pi , linux. i'm trying find way image pal camera digitised , pi. have looked @ making framegrabber , connecting csi port clear port not open source , cannot modified different camera.
attempting input digital image via network port using udp. source image 768x576 pixels of 24bit rgb.
have set tests , transmitting image data via udp windows pc , displaying reconstructed image in picture box in visual basic. each image taking 125msec transmit on 100mhz lan. need transmit/receive 4 images per second seems viable.
need test on linux , more importantly raspberry pi see if can handle data stream, have no linux development experience. @ start of today (12 hours ago) learned gcc was! since i've managed create console based udp server on pi , accept incoming messages pc. set trying write framebuffer, laptop ubuntu not that. tried learn gtk+to use gtkimage widget, see udp server code wont run in gtk applications. i'm pulling hair out trying learn many things proof of concept on pi
can please?
need simple program accept rgb image data via udp 1 pc , reconstruct image on screen.
have learned today believe image data should read character buffer , loaded gtkimage, (but again there may better ways.)
udp has maximum message size of 64kb image data sent in 'chunks' of 50,000 bytes (arbitrary value). each chunk carries single byte control character @ end of data indicate if last chunk (which treated differently)
below sample of vb code showing how data received in vb program.
if can guidelines or sample code proof of concept grateful. please bear in mind have total of 1 days experience in linux, gtk+, rasperry pi etc.
in advance help
mike
i'm electronics engineer complete novice on raspberry pi , linux. i'm trying find way image pal camera digitised , pi. have looked @ making framegrabber , connecting csi port clear port not open source , cannot modified different camera.
attempting input digital image via network port using udp. source image 768x576 pixels of 24bit rgb.
have set tests , transmitting image data via udp windows pc , displaying reconstructed image in picture box in visual basic. each image taking 125msec transmit on 100mhz lan. need transmit/receive 4 images per second seems viable.
need test on linux , more importantly raspberry pi see if can handle data stream, have no linux development experience. @ start of today (12 hours ago) learned gcc was! since i've managed create console based udp server on pi , accept incoming messages pc. set trying write framebuffer, laptop ubuntu not that. tried learn gtk+to use gtkimage widget, see udp server code wont run in gtk applications. i'm pulling hair out trying learn many things proof of concept on pi
can please?
need simple program accept rgb image data via udp 1 pc , reconstruct image on screen.
have learned today believe image data should read character buffer , loaded gtkimage, (but again there may better ways.)
udp has maximum message size of 64kb image data sent in 'chunks' of 50,000 bytes (arbitrary value). each chunk carries single byte control character @ end of data indicate if last chunk (which treated differently)
below sample of vb code showing how data received in vb program.
if can guidelines or sample code proof of concept grateful. please bear in mind have total of 1 days experience in linux, gtk+, rasperry pi etc.
in advance help
mike
code: select all
public sub receiveimage() static starttime int64 static finishtime int64 dim elapsedtime int64 dim message byte() = new byte() {} dim bytecount int64 = 0 dim messageindex int64 = 0 'data received in chunks because of 64k message size limit 'the program atomatically allows different sizes of image received 'array receive image data dim receivebytes [byte]() 'get data socket. receive bytes contain number of 'this first chunk of bytes received. receivebytes = receivingudpclient.receive(remoteipendpoint) 'log start time - performance monitoring starttime = now.ticks 'check if data received last chunk of data 'if last byte of chunk 22 complete chunk of 50000 bytes. while receivebytes(receivebytes.length - 1) = 22 'getting chunk 'add total number of bytes received bytecount = bytecount + receivebytes.length - 1 'keep resizing message buffer more data arrives redim preserve message(bytecount) 'append last recieved data whole message array array.copy(receivebytes, 0, message, messageindex, receivebytes.length) messageindex = bytecount 'get next chunk of data receivebytes = receivingudpclient.receive(remoteipendpoint) loop 'we have exited loop because last chunk of data did not have control byte value of 22 'so have deal last chunk - of unknown length. if receivebytes(receivebytes.length - 1) = 33 '33 means last chunk redim preserve message(bytecount + receivebytes.length - 1) 'append last bytes of data message array array.copy(receivebytes, 0, message, messageindex, receivebytes.length - 1) 'last chunk show image if message.length = 1327159 createimage(message) finishtime = now.ticks elapsedtime = (finishtime - starttime) / 10000 'txttimer.text = elapsedtime.totalseconds.tostring("0.000000") me.invoke(new writecontrol(addressof writetexttimer), new object() {elapsedtime.tostring & " msec"}) else finishtime = now.ticks elapsedtime = (finishtime - starttime) / 10000 'txttimer.text = elapsedtime.totalseconds.tostring("0.000000") me.invoke(new writecontrol(addressof writetexttimer), new object() {"error"}) end if end if 'start process again waiting next image newinitialize() end sub
do have c proramming experience ? if not , guess try learn work gambas , seem familiar visual basic .
ghans
ghans
raspberrypi
Comments
Post a Comment