Sedang Disiapkan

Write windows C/C++ code to quickly transform and display an image. Version 2

Rewrite my slow perl script in C/C++. Provide me with the SIMPLE source code and instructions on how to compile it in a "free" windows environment. I would prefer something like the windows express C++ environment that I can just take your C++ and compile and make it work. I don't want to have to buy a $1000 development environment. Or some free command line tools might be even better. Here is my perl script. Please provide me with a quote to do this job.

Your code will have the following properties.

It runs and follows my example of first opening sockets in ordrer

to get an image from the network device.

Then it takes the data and puts an image on the screen.

It does not use MSPAINT.EXE. I did that because it was increadibly

easy for me to get it working. Instead it opens a window and displays the image. The code should be able to then send out another command to get another image so that we can see the next image replace the old one. This would basically be video althought due to speed limitations we would really onlbe able to achieve a 2-5 frames per second perhaps. So I think displaying one image at a time would be acceptable.

# Camera image display Program

use IO::Socket::INET;

use Imager;

print "Cam Control";

$img = Imager->new(xsize=>1280, ysize=>1024); # imager object

# Open a receiver socket

$ReceiveSock=new IO::Socket::INET->new(LocalPort=>1233,Proto=>'udp') or die "error, cannot create receive socketn";

$newval = pack("I",3000000);

setsockopt($ReceiveSock, SOL_SOCKET, SO_RCVBUF, $newval);

# Open a send sockete

$SendSocket=new IO::Socket::INET->new(LocalAddr => 'localhost', LocalPort=>1234, Type=>SOCK_DGRAM, PeerPort=>1234,Proto=>'udp',

PeerAddr=>inet_ntoa(INADDR_BROADCAST),Broadcast=>1) or die "cannot create send socketn";

$msg='U'; # tells camera to send a frame

print "nSending message '",$msg,"'";

if($SendSocket->send($msg))

{

print ".....<done>","n";

}

$rowcount=0;

while($rowcount != 2048) { # of course this is stupid because it will lock up if we don't get all the rows for some reason

$ReceiveSock->recv($text,2000);

$row[$rowcount] = $text; # $text is actually a bunch of binary 8 bit words full of image YUYV data (YUV 4:2:2)

$rowcount++;

}

print "Got all the rows.n";

# convert to one row per row because each packet is actually half a row

for ($i=0; $i<1024; $i++) {

$row[$i] = substr($row[$i*2],2,1280) . substr($row[$i*2+1],2,1280);

}

# convert to RGB format

for ($j=0; $j<1024; $j++) {

@drow = unpack( 'C*' , $row[$j]);

for ($i=0; $i<640; $i++) {

# $setrow[$i*8] = $drow[$i*4] + int([url removed, login to view]*($drow[$i*4+3]-128)); # red

# $setrow[$i*8+1] = $drow[$i*4] + int([url removed, login to view]*($drow[$i*4+1]-128)) - int([url removed, login to view]*($drow[$i*4+3]-128)); # green

# $setrow[$i*8+2] = $drow[$i*4] + int([url removed, login to view]*($drow[$i*4+1]-128)); # blue

# $setrow[$i*8+3] = 255;

# $setrow[$i*8+4] = $drow[$i*4+2] + int([url removed, login to view]*($drow[$i*4+3]-128)); # red

# $setrow[$i*8+4+1] = $drow[$i*4+2] + int([url removed, login to view]*($drow[$i*4+1]-128)) - int([url removed, login to view]*($drow[$i*4+3]-128)); # green

# $setrow[$i*8+4+2] = $drow[$i*4+2] + int([url removed, login to view]*($drow[$i*4+1]-128)); # blue

# $setrow[$i*8+4+3] = 255;

$setrow[$i*8] = $drow[$i*4] + int([url removed, login to view]*($drow[$i*4+3]-128)); # red

$setrow[$i*8+1] = $drow[$i*4] + int([url removed, login to view]*($drow[$i*4+1]-128)) - int([url removed, login to view]*($drow[$i*4+3]-128)); # green

$setrow[$i*8+2] = $drow[$i*4] + int([url removed, login to view]*($drow[$i*4+1]-128)); # blue

$setrow[$i*8+3] = 255;

$setrow[$i*8+4] = $drow[$i*4+2] + int([url removed, login to view]*($drow[$i*4+3]-128)); # red

$setrow[$i*8+4+1] = $drow[$i*4+2] + int([url removed, login to view]*($drow[$i*4+1]-128)) - int([url removed, login to view]*($drow[$i*4+3]-128)); # green

$setrow[$i*8+4+2] = $drow[$i*4+2] + int([url removed, login to view]*($drow[$i*4+1]-128)); # blue

$setrow[$i*8+4+3] = 255;

}

for ($i=0; $i<5120; $i++) {

if ($setrow[$i] < 0) {$setrow[$i] = 0;}

if ($setrow[$i] > 255) {$setrow[$i] = 255;}

}

$setstring = pack ('C*',@setrow);

$img->setscanline(y=>$j,pixels=>$setstring);

# $img->setscanline(y=>$j,pixels=>pack("C*",(255,0,0,255,0,255,0,255,0,0,255,255,255,0,0,255)));

}

$img->write(file=>"testimg.bmp",type=>'bmp') or die "Cannot write image filen";

system ('mspaint [url removed, login to view]');

Kemahiran: Pengaturcaraan C, Destop Windows

Lihat lebih lanjut: write program drow frame, display rgb image, display image code, write code transform image, code display image, socket image transform, work c, simple binary code, simple binary, red binary, print pack, old second, no code, job quote example, int i, write line, use binary, get better job, code binary, how code, binary work, free write, free code, free cam program, first code

Tentang Majikan:
( 6 ulasan ) Colorado Springs, United States

ID Projek: #108526