Applicatie in PHP voor analyse kleurgebruik

Tijdens het promotieonderzoek van Suzanne heb ik een applicatie gemaakt in PHP voor het analyseren van het kleurgebruik in tekeningen gemaakt door proefpersonen. Verschillende condities tijdens een onderzoek zouden kunnen/moeten leiden tot verschillende uitkomsten na de opdracht: “teken een boom”.

Uiteindelijk is de analyse met een Python script gedaan omdat Python een dergelijke functie sneller kan uitvoeren, o.a. vanwege het uitgebreide pakket aan functies dat in Python aanwezig is. Mocht je echter alleen kennis van PHP hebben zoals ik, dan hieronder dan het belangrijkste deel van script. Het script bestaat uit 3 functies. De functie scale wordt gebruikt om het aantal mogelijke kleuren (256Rx256Gx256B=16,7miljoen) te reduceren naar 64 kleuren (4Rx4Gx4B). Dit vergemakkelijkt het vergelijken van de output met de output van een andere analyse. (het heeft geen effect op de parse time) De functie getcolor koppelt de kleur terug op het gevraagde coordinaat in de afbeelding. De functie colors is de basis loop die met de functie getcolor alle coordinaten in de afbeelding afloopt. Met de outputvariabele kun je zelf waardes berekenen en een format maken voor de complete output.

Mijn systeem (Intel Centrino 1,66GHz en 2,5GB geheugen) met XAMPP versie 1.5.3a heeft 1 seconde nodig voor 96×144 pixels (13.824pixels), 5 seconden voor 320×480 pixels (153.600pixels) en 69 seconden voor 2032x1524pixels (3.096.768pixels).

Contact me if you’re interested in the full code.

<?php
$st=time();
set_time_limit(0);function scale($c) {
if ($c<=42) {$c=0;}
elseif ($c<=83) {$c=83;}
elseif ($c<=124) {$c=83;}
elseif ($c<=166) {$c=166;}
elseif ($c<=208) {$c=166;}
elseif ($c>208) {$c=255;}
return $c;
}function getcolor($im, $x, $y) {
unset($rgb, $r,$g,$b);
$rgb = ImageColorAt($im, $x, $y);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
return scale($r).”#”.scale($g).”#”.scale($b);
}function colors($img,$x,$y,$w,$h) {
$arr = array(“255#255#255”);
$img = ImageCreateFromPng($img);
for ($i = $y; $i < ($y+$h); $i++) {
for ($j = $x; $j < ($x+$w); $j++) {
array_push($arr,getcolor($img, $j, $i));
}
}
return $arr;
}

$image = “kleurplaat2.png”;
$x=1;
$y=1;
$w=96;
$h=144;

$allcolors = colors($image,$x,$y,$w,$h);
$pixelscounted = count($allcolors)-1;
$uniquecolors = count(array_unique($allcolors));
echo “Analysis area: x:”.$x.”, y:”.$y.”, w:”.$w.”, h:”.$h.”<br>\r\n”;
echo “Pixels counted: “.$pixelscounted.” of “.($w*$h).”<br>\r\n”;
echo “Contains: “.$uniquecolors.” unique colors<br>\r\n”;

echo “<br><br>\r\n”;

$keyvals=array_count_values($allcolors);
echo “keyvals “; print_r($keyvals);

cialis dosage recommendations viagra soft viagra pills vardenafil vs viagra azithromycin for strep throat cialis medication finasteride tablets acyclovir 800 mg equipe argentine viagra viagra vs cialis lexapro and weight gain in women viagra en ligne livraison 24h cialis reviews ciprofloxacin hydrochloride escitalopram 10mg viagra vs cialis vs levitra azithromycin eye drops levitra 20 mg viagra tesco propecia side effects azithromycin side effects free viagra what is escitalopram azithromycin tablet pfizer viagra coupons from pfizer azithromycin 500 mg what is cialis ciprofloxacin hcl 500 mg tab viagra nebenwirkungen azithromycin 5 day dose pack finasteride for women viagra cialis cialis website viagra tablet erectile dysfunction cialis azithromycin pregnancy escitalopram oxalate ciprofloxacin lexapro reviews viagra generic viagra 100mg ciprofloxacin dosage viagra cost what is cipro usually prescribed for what is azithromycin cilias buy cialis online side effects of lexapro in women acyclovir 800 mg for shingles azithromycin 500 what does viagra do what is ciprofloxacin online cialis cialis vs viagra azithromycine finasteride effets secondaires lexapro benefits for women ciprofloxacin ophthalmic solution how to wean off lexapro without withdrawals zithromax what does finasteride do lexapro and weight gain finasteride dosage tamoxifen nebenwirkungen azithromycin tablets how long for lexapro to work cipro 500 what is viagra side effects of finasteride 5mg levitra prezzo in farmacia viagra canada how does viagra work is azithromycin canadian viagra ciprofloxacin used for zithromax z-pak viagra canada cialis levitra coupon cialis samples cialis 20mg zovirax for cold sores tamoxifen interaction buy viagra azithromycine 250 mg finasteride reviews what is cipro used for what is acyclovir for cialis coupon tamoxifen langzeitfolgen revatio vs viagra lexapro and weight loss cialis sample how much does cialis cost stopping lexapro cialis effects levitra rezeptfrei deutschland cialis cheap ciprofloxacin spc side effects of tamoxifen what is ciprofloxacin prescribed for viagra side effects what is lexapro viagra coupon viagra bestellen azithromycin 250 mg lexapro vs zoloft levitra cipro for uti azithromycin 250mg acyclovir dosage levitra vs viagra zithromax antibiotic finasteride 5 mg tab zovirax finasteride 5mg acyclovir ointment cialis 20mg directions best price viagra 200 cialis coupon lexapro para que sirve viagra wiki what does ciprofloxacin treat free cialis what is cipro viagra 100 herbal viagra finasteride long term effects acyclovir for shingles viagra 100mg tablets retail price natural viagra cialis generic tadalafil cialis professional azithromycin 250 mg treatment viagra single packs lexapro and wellbutrin combination therapy viagra coupons finasteride cipro drug class azithromycin drug class ciprofloxacin 250 mg cialis coupons 2017 effects of stopping lexapro suddenly viagra for sale online viagra ciprofloxacin hcl 500 mg finasteride vs dutasteride cealis liquid cialis is lexapro a controlled substance acyclovir for cold sores finasteride medication viagra 100 mg zovirax pills finasteride and enlarged prostate tamoxifen viagra online where to buy viagra lexapro 10 mg viagra pillen kruidvat cipro side effects acyclovir 800mg what is lexapro used for side effects of lexapro 10 mg side effects of azithromycin cialas cialis patent expiration date extended finasteride 5mg side effects mayo clinic viagra generico cialis without a doctor’s prescription levitra 20mg cost per pill what bacteria does ciprofloxacin kill lexapro dosing cyalis cheap viagra cipro dosage cialis pills azithromycin coverage women viagra lexapro withdrawal symptoms viagra costs azithromycin 250 what works better than viagra buy cialis generic for cialis cialis online lexapro manufacturer website ciprofloxacin nebenwirkungen cipro side effects in elderly escitalopram effets secondaires lexapro for anxiety azithromycine eg 500 mg bijsluiter lexapro generic name levitra online lexapro generic ciprofloxacin 500mg tablets cialis coupons what is azithromycin for when will cialis go generic wholesale cialis generic levitra vardenafil 20mg azithromycin z pak acyclovir dosage for cold sores ciprofloxacin eye drops azithromycin cost cipro uses ciprofloxacin drug class how long does viagra last viagra on line levitra vs viagra for hardness azithromycin 500mg acyclovir side effects what is tamoxifen used for lexapro side effects cialis 5mg daily cheap levitra cialis discount sex viagra for women what does azithromycin treat finasteride for hair loss what is acyclovir used for tamoxifen citrate cheap cialis ciprofloxacin coverage levitra 10 mg prezzo tamoxifen and bone pain cipro dangers buy generic viagra how to get off lexapro what is acyclovir viagra natural ciprofloxacin hcl 500 mg side effects thuoc azithromycin viagra kaufen cialis otc viagra dosage azithromycin pregnancy category lexapro weight gain lexapro coupons azithromycin for pneumonia generic cialis ciprofloxacin 500mg levitra 20 mg precio farmacia common side effects of ciprofloxacin 500 mg azithromycin liquid antibiotic ciprofloxacin viagra for sale uk ciprofloxacin 250mg is tamoxifen chemotherapy viagra without a doctor prescription canada viagra side effects of azithromycin 250 mg cialis 10 mg viagra sex cost of viagra sophia viagra how to use viagra zithromax 500 mg generic for lexapro azithromycin for uti discount cialis how long for azithromycin to take effect what is ciprofloxacin used for azithromycin vs erythromycin viagra without a doctor prescription usa discount viagra ciprofloxacin side effects after age 60 weaning off lexapro ciprofloxacin 500mg antibiotics ciprofloxacin 500 how to wean off lexapro lexapro overdose zovirax ointment acyclovir dose what infections does ciprofloxacin treat lexapro vs wellbutrin pfizer viagra acyclovir 400 mg acyclovir dosing buy viagra online cialis dosage strengths viamedic cialis side effects of cialis cialis canadian pharmacy cialis free trial ciprofloxacin 500mg antibiotics side effects price cialis side effects of ciprofloxacin first few days on lexapro female viagra viagra for men what is tamoxifen viagra activate how does cialis work generic viagra levitra without a doctor prescription ciprofloxacin 500 mg tabletten cialis trial cialis alternative tamoxifen cost side effects lexapro ciprofloxacin bnf ciprofloxacin dose viagra samples buy generic levitra viagra price cialis samples overnight what is lexapro for lexapro dosage lexapro dosages viagra receptfritt levitra 20mg cipro antibiotic viagra alternative finasteride side effects in men levitra 20 mg von bayer viagra substitute finasteride efectos secundarios ciprofloxacin side effects in women celexa vs lexapro cialis coupons printable acyclovir 400mg finasteride 5mg tab side effects of lexapro cost of cialis buy levitra cialis pharmacy prices levitra 20 mg cost walmart azithromycin three times a week acyclovir medication viagra ohne rezept aus deutschland ciprofloxacin hcl cialis pricing azithromycin uses escitalopram 10 mg para que sirve finasteride hair loss cialis 30 day sample cialis coupon print lexapro bula ciprofloxacin for dogs cialis for sale tamoxifen side effects in women over 55 cialis for women over the counter viagra lexapro 20mg viagra pill cialis cost cialis price levitra vs viagra lexapro medication cialis prices viagra from canada tamoxifen side effects cialis copay card cialis dosage canadian cialis acyclovir 800 mg 5 times a day viagra medicine cialis for bph cialis for daily use azithromycin dosage cipro cialis 20 mg acyclovir cream cialis daily levitra erfahrungen tamoxifen and foods to avoid what does ciprofloxacin 500mg treat azithromycin 250mg tablets 6 pack side effects of viagra what is finasteride lexapro side effects men cialis generic availability lexapro side effects in men ciprofloxacin side effects ciprofloxacin 500 mg cialis on line finasteride 1mg azithromycin without a doctor’s prescription cialis generic acyclovir what is azithromycin used for nolvadex side effects of acyclovir viagra sans ordonnance order viagra cialis for men how to take cialis zovirax cream escitalopram 20 mg withdrawal from lexapro cialis pills for sale side effects of finasteride azithromycin viagra on line no prec tamoxifen bijwerkingen cialis voucher what is finasteride used for 9 levitra at walmart viagra for women how does acyclovir work levitra coupons is azithromycin penicillin azithromycin and alcohol acyclovir 200mg viagra vs cialis vs levitra vardenafil 20mg generic cialis at walmart lexapro vs celexa ciprofloxacin hydrochloride ophthalmic cialis from canada acyclovir ointment 5 buying viagra generic cialis tadalafil lexapro withdrawal levitra prices wellbutrin and lexapro generic viagra 100mg cialis side effects effects of stopping finasteride escitalopram nebenwirkungen finasteride permanent side effects levitra generic escitalopram side effects cialis patent expiration 2017 lowest cialis prices utilisation viagra cialis coupons from manufacturer lexapro propecia finasteride results finasteride 5mg side effects escitalopram 10 mg is ciprofloxacin a penicillin how does lexapro work daily cialis generic lexapro viagra prices cialis testimonials ciprofloxacin 500 mg for urinary tract infection buy levitra online viagra alternatives finasteride 5 mg azithromycin pediatric dosing post finasteride syndrome cialis coupon 20 mg ciprofloxacin uses levitra dosage cialis savings card tamoxifen and weight gain azithromycin medscape finasteride side effects acyclovir vs valacyclovir cialis 5mg tamoxifen therapy cialis patent expiration viagra wikipedia tamoxifen lawsuits cipro and tendonitis lexapro 10mg ciprofloxacin dosierung cialis or viagra side effects of ciprofloxacin 500 mg cialis canada azithromycin class escitalopram cialis tadalafil zoloft vs lexapro ciprofloxacin class lexapro side effects in women cialis 30 day trial coupon azithromycin 500 erfahrungen cipro antibiotics viagra vs cialis does lexapro cause weight gain generic levitra cialis 5 mg lexapro 5mg cialis vs viagra viagra ohne rezept auf rechnung cialis zithromax dosage levitra bayer 20mg meilleur prix viagra effects tamoxifen side effects in women ciprofloxacin drops viagra 50mg viagra tablets viagra uk zovirax dosage