Find Jobs
Hire Freelancers

PHP convert Image to RGB565, compress, show stat's and download

$30-250 USD

Chiuso
Pubblicato circa 5 anni fa

$30-250 USD

Pagato al completamento
I am working on logic for a Microcontroller that dynamically updates a screen via UART. The screen only accepts vector based commands to fill a coordinate with a square and a filled color. The command looks like so fill x,y,h,w,<color> The PHP code I wrote so far takes the image and converts each pixel to the following format, However, there are tons of room for optimization. An idea I had was to take the image and find the most common color then set the whole screen to this color. Then find all pixel's within a given shade and make it the same color than that beings the fill command to a single command because it can then cover two squares by using the command x,y,2,1,<color>. The goal is to generate the picture with lossy compression but without extremely affecting the image and as few FILL commands as possible. During the development of these algorithms, your PHP code will need to display the before and after image and the number of FILL lines required to draw the image. The Binary data of the x,y, color will then be sent as a .bin file when requested from the .php script. It can be your own or someone else's algorithm.. just make it possible to redraw with least amount of commands Examples of algorithms are like this. Cycle through each pixel and neighboring pixels and if they are similar shade make them the same. Then find the most common color and set the background image to that color. then cycle through each pixel if it's not that background color fill in that color. The least amount of times you have to cast the fill command to drop a pixel the better the algorithm! A sample image that will be used is here [login to view URL] In this case, the large portion of the map is gray, so its best to make that shade one distinct RGB565 color then set the image of the full background to that color using a single fill command. Then cycle through each pixel and combine additional like colors to make the least amount of permutations to cast a fill command to fill a pixel or a subset of pixels. When doing this without any compression you would have to cast nearly one fill command for each pixel and would take over 5 minutes to draw a screen which is not a doable solution however there should be a simple way to go upon this. Sample PHP code to get started. <?php $img = imagecreatefromjpeg("Path to Image that is 480x272"); $width = ImageSX($img); $height = ImageSY($img); for ($y = 0; $y < $height; $y++) { for ($x = 0; $x < $width; $x++) { $c = imageColorAt($img, $x, $y); $r = ($c >> 16) & 0xFF; $g = ($c >> 8) & 0xFF; $b = $c & 0xFF; $r = $r >> 3; $g = $g >> 2; $b = $b >> 3; $oc = ($r << 11) | ($g << 5) | $b; echo ("fill $x,$y,1,1,$oc<br>"); } } ?>
Rif. progetto: 19339774

Info sul progetto

5 proposte
Progetto a distanza
Attivo 5 anni fa

Hai voglia di guadagnare un po'?

I vantaggi delle offerte su Freelancer

Imposta il tuo budget e le scadenze
Fatti pagare per il lavoro svolto
Delinea la tua proposta
La registrazione e le offerte sui lavori sono gratuite

Info sul cliente

Bandiera: UNITED STATES
Palm Desert, United States
5,0
6
Metodo di pagamento verificato
Membro dal dic 28, 2004

Verifica del cliente

Grazie! Ti abbiamo inviato tramite email il link per richiedere il tuo bonus gratuito.
Non è stato possibile inviarti l'email. Riprova per piacere.
di utenti registrati di lavori pubblicati
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Caricamento anteprima
Autorizzazione per la geolocalizzazione concessa.
La tua sessione è scaduta ed è stato effettuato il log out. Accedi nuovamente per piacere.