Find Jobs
Hire Freelancers

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

$30-100 USD

Em Andamento
Publicado há mais de 17 anos

$30-100 USD

Pago na entrega
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(1.14*($drow[$i*4+3]-128)); # red # $setrow[$i*8+1] = $drow[$i*4] + int(-0.395*($drow[$i*4+1]-128)) - int(0.581*($drow[$i*4+3]-128)); # green # $setrow[$i*8+2] = $drow[$i*4] + int(2.032*($drow[$i*4+1]-128)); # blue # $setrow[$i*8+3] = 255; # $setrow[$i*8+4] = $drow[$i*4+2] + int(1.14*($drow[$i*4+3]-128)); # red # $setrow[$i*8+4+1] = $drow[$i*4+2] + int(-0.395*($drow[$i*4+1]-128)) - int(0.581*($drow[$i*4+3]-128)); # green # $setrow[$i*8+4+2] = $drow[$i*4+2] + int(2.032*($drow[$i*4+1]-128)); # blue # $setrow[$i*8+4+3] = 255; $setrow[$i*8] = $drow[$i*4] + int(1.41*($drow[$i*4+3]-128)); # red $setrow[$i*8+1] = $drow[$i*4] + int(-0.345*($drow[$i*4+1]-128)) - int(0.717*($drow[$i*4+3]-128)); # green $setrow[$i*8+2] = $drow[$i*4] + int(1.78*($drow[$i*4+1]-128)); # blue $setrow[$i*8+3] = 255; $setrow[$i*8+4] = $drow[$i*4+2] + int(1.41*($drow[$i*4+3]-128)); # red $setrow[$i*8+4+1] = $drow[$i*4+2] + int(-0.345*($drow[$i*4+1]-128)) - int(0.717*($drow[$i*4+3]-128)); # green $setrow[$i*8+4+2] = $drow[$i*4+2] + int(1.78*($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 [login to view URL]');
ID do Projeto: 108526

Sobre o projeto

7 propostas
Projeto remoto
Ativo há 17 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos

Sobre o cliente

Bandeira do(a) UNITED STATES
Colorado Springs, United States
5,0
6
Membro desde ago. 26, 2005

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.