May 30, 2009

Installing pngwriter: a library to write png image

To install pngwrite we need to install to helper library before we install pngwriter.
1. libpng
2. freetype2

We can use fink or macport to install them. Using macport

-> port install libpng
-> port install freetype

both will be installed on /opt/local directory.
(.h files in /opt/local/include .dylib files in /opt/local/lib)

Then we can download the pngwriter from here.
PNGWRITER

To install pngwriter
1. untar the zipped file.
The go inside the folder.
->make
->make install

This will install the pngwriter in /usr/local
(.h files in /usr/local/include and .dylib files in /usr/local/lib)

To use the pngwriter library we need just to add the pngwriter.h file.
#include (pngwriter.h)
int main()
{
pngwriter image(200, 300, 1.0, "out.png");
image.plot(30, 40, 1.0, 0.0, 0.0);
image.close();
return 0;
}
Let this be a sample program write_test.cpp.

To compile the program we need to the following command
g++ write_test.cpp -o test -I/opt/local/include/freetype2 -I/opt/local/include
-I/usr/local/include -L/usr/local/lib -L/opt/local/lib -lpng -lpngwriter -lz -lfreetype

(Note: you have to specifically give the include path for freetype -I/opt/local/include/freetype2 -I/opt/local/include.
And: since pngwriter is installed on /usr/local/include, so is the include path for pngwriter. The lib files are on -L/opt/local/lib (for freetype and libpng ) and -L/usr/local/lib ( for pngwriter ).

(Note: pngwriter assumes the lower left corner to be origin(0,0) and upper right corner is at (width, height))

Sample pngwriter code:
----------------------

This program reads two images and finds the HSV components (of the corresponding white region of the segmented binary image.) of the color image.

int main(int argc, char* argv[])
{
if ( argc < 4 )
{
cerr << "Usage: area " << endl;
return -1;
}
//
// MagickCore::SetMagickResourceLimit(MagickCore::MemoryResource, 1536);
// MagickCore::SetMagickResourceLimit(MagickCore::MapResource, 2048);
// Image* img = new Image(argv[1]);


map mapHSV_H;
map mapHSV_S;
map mapHSV_V;

// read the segmented image
pngwriter imageSegmented;
imageSegmented.readfromfile(argv[1]);

// read the color image

pngwriter imageColor;
imageColor.readfromfile(argv[2]);

int widthS = imageSegmented.getwidth();
int heightS = imageSegmented.getheight();

int widthC = imageColor.getwidth();
int heightC = imageColor.getheight();

int width, height;

if ( widthS == widthC && heightS == heightC) {
width = widthS, height = heightS;
} else {
cerr<<"Unequal dimension of the two input images"< exit(1);
}


for (int j=0; j for (int i=0; i
// read the segmented image if the pixel is white then find the HSV component of that pixel
double red = imageSegmented.dread(i, j, RGB_R);
double green = imageSegmented.dread(i, j, RGB_G);
double blue = imageSegmented.dread(i, j, RGB_B);

cout<<"R = "<

16 comments:

Anonymous said...

любительские порно фото школьницы http://free-3x.com/ онлайн видео подростки секс free-3x.com/ изнасилование малолетки видео онлайн [url=http://free-3x.com/]free-3x.com[/url]

Anonymous said...

Ich bin endlich, ich tue Abbitte, aber es kommt mir nicht heran. Ich werde weiter suchen. cialis rezeptfrei viagra wirkungseintritt [url=http//t7-isis.org]viagra[/url]

Anonymous said...

hi

can anyone help me
i have tried for over a week now to get a loan,i have very bad credit history mainly due to a failed marrage ,i have had all the usual ,wh loans,advantage loans ,yes loans ,get in touch and promise a [url=http://www.usainstantpayday.com]bad credit loans[/url] on paying the brokerage fee,i am reluctant due to reviews on the net and i have been stung before by a company called wentorth finance ,and never got the loan of the 50 pound fee back,
i have had an offer from flm but need a gaurantor which isnt really an option either .
i wondered if anyone had any loan companys that considered bad credit ,but loaned direct without these numerous sites with different alias but mainly did same thing pay us and we will get u loan (maybe)senario
has anyone also heard of a company called fresh loans they have they sent me details out but the may be a charge but not always ,i suspect she didnt want to tell me there was a charge

thanks
edgetaEarnerb

Anonymous said...

[color=#5588aa]Hi

With the continuing rise in popularity of facebook poker chips as a virtual currency in facebook texas holdem poker game many scammers have engaged themselves, who try their best to trick unsuspecting players out of their hard earned yahoo poker chips. All over the internet forums are littered with posts by innocent people who have had their poker chips stolen. Nothing is as sorry state as logging to Facebook or MySpace to play a few hands of poker only to find that someone has already been in your account and your poker chips are gone.[/color]

[url=http://www.chipshut.com][img]http://www.chipshut.com/img/facebook-poker-chips-hut.jpg[/img][/url]

[color=#5588aa]Keep these basic things in mind to protect your facebook poker chips:

Never give your password to a stranger: Trust is a delicate thing that takes a long time to build but only second to destroy. You may meet a sexy girl in poker room and you are friends with him/her. He/she will keep interacting with you days before playing her trick. So be carefull enough to protect your login credentials to yourself, else this may lead to disaster.

Be careful about what you download: Serious online gamers are looking for cheats or hacks for the games they play in order to give them an advantage on their opponents. Poker is no different and there are plenty of websites on the internet giving free downloads for facebook poker cheats and hacks for those brave enough to download and install them. But many of these so called facebook poker cheats have viruses or trojan programs. The moment you install any of these your computer is at the risk of attacks by the creator of the program. He can then have access to vital information that you access from your computer. Leaving your facebook poker account at risk of been hacked. If you never downloaded any of these programs then you’re probably safe, and if you have then you should run a spyware detection program. The best move will be for get your computer formatted to avoid any loop holes.

Phishing Links: This way of hacking has been thee for quite sometime now. Scammers send legitimate and official looking emails to your inbox. When you open them you are asked to click on the link and login in order to save your account or win free facebook poker chips, but in reality you are logging into a fake site that sends your information off to the theif who made it. Before you find it out, its too late to react and they would have already broken into your account and emptied it of any facebook poker chips that you may have.

YouTube scams: If you do a search on youtube for facebook poker cheats, zynga poker hacks, or free facebook poker chips you’ll find hundreds of videos on the topic. More than 90% of them are made by idiots hoping to convince you to send them your account information. They range from slightly clever to completely moronic.

Image Photo Having Exe Embedded In it: This one is hard to catch. This is the latest fashion that is used by scammer, you will be asked to share family photo's. When you open their photo, that will innitiate an exe in the background which will steal all your information and send to the mastermind behin it. So be careful with whom you share photos.

Hope these tips help you saving your chips.

These tips have been brought to you by [/color][url=http://www.chipshut.com]Chips Hut[/url][color=#5588aa] if you are looking to buy [/color][url=http://www.chipshut.com]facebook poker chips[/url], [color=#5588aa]you may go to our online store.

Thanks[/color][img]http://www.chipshut.com/img/chips-hut-smily.gif[/img]

Anonymous said...

Hello, as you can see this is my first post here.
In first steps it is very nice if somebody supports you, so hope to meet friendly and helpful people here. Let me know if I can help you.
Thanks and good luck everyone! ;)

Anonymous said...

good afternoonpeople this is a great forum hope im welcome :)

Anonymous said...

Buy online generic medicines from [url=http://allergyrxstore.com/] Drugstore[/url] , no prior prescription and free consultation. On our medicine from [url=http://allergyrxstore.com/] Reputable Pharmac[/url] you can [url=http://allergyrxstore.com/] buy online cheap medication[/url] Clarinex .

Anonymous said...

Jaka jest najlepsza stronka po polsku o kredycie sms? Szukam mozliwie jak najszybciej chwilowki albo pozyczki sms.

Znalazlem ta strone, jest ona najlepsza [url=http://studencki-kredyt.pl/kredyt-sms.html]kredyt sms[/url].

Licze na to ze ci to pomoglo, pozdrawiam z Polski.

Anonymous said...

Jezeli interesuja cie dokladniejsze informacje na temat wnioskow o bron palna to zajrzyj na ta strone [url=http://studencki-kredyt.pl/pozwolenie-na-bron.html]pozwolenie na bron[/url].


[url=http://studencki-kredyt.pl/pozwolenie-na-bron.html]pozwolenie na bron palna[/url]

Anonymous said...

Buy online generic drugs from [url=http://allergyrxstore.com/] Drugstore[/url] , no prior prescription and free consultation. On our medicines from [url=http://allergyrxstore.com/]online Drugstore[/url] you can [url=http://allergyrxstore.com/] buy online generics[/url] Claritin (Loratadine) .

Anonymous said...

hoodia diet pill diets pills hozantac drugs

[url=http://www.bebo.com/buylevitraonline1]buy dreampharmaceuticalscom levitra online[/url]

Anonymous said...

Hello, as you can see this is my first post here.
In first steps it's very good if somebody supports you, so hope to meet friendly and helpful people here. Let me know if I can help you.
Thanks and good luck everyone! ;)

Anonymous said...

canada meet singles [url=http://loveepicentre.com/]cross road dating[/url] special dating services http://loveepicentre.com/ radiometric dating

Anonymous said...

Hello everyone.

Do you enjoy watching TV shows online?

Watch popular TV shows such as Gossip Girl, Weeds, Lost and much more!

[url=http://www.channelblender.com/tv/tv-shows]Watch New Moon[/url]

Anonymous said...

Exceptional web site!

Most everyone needs to get insurance at one time or another, whether it is
auto insurance, life insurance, health insurance, or homeowners insurance.
These days it is more painless than ever to find complimentary insurance quotes from various
companies in order to find the optimal deal. You can also discover how to preserve
lots of money in free gasoline when you get your insurance price quotes.

[url=http://freeinsurancequoteshq.com]Free insurance quotes[/url]
http://freeinsurancequoteshq.com

[url=http://freeinsurancequoteshq.com/life/term-life-insurance-price-quote.html]Term life insurance price quote[/url]

http://freeinsurancequoteshq.com/life/term-life-insurance-price-quote.htm

Anonymous said...

What words...

Carlo Cipolla's Laws of Stupidity

    "By creating a graph of Cipolla's two factors, we obtain four groups of people. Helpless people contribute to society but are...