LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-05-2017, 01:31 PM   #1
lumbut
LQ Newbie
 
Registered: Apr 2017
Posts: 2

Rep: Reputation: Disabled
how to convert every point in photo into digital by my own library?


Hi, I am a C programmer, want to make my own
library (convert every point of photo to digital based on the color of this point), like small OpenCV
how to do that?
 
Old 05-05-2017, 02:22 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
There are two very important pieces of information missing from your question:

* The nature of the source photo
* The desired final encoding

If it is a film-to-print photograph then you must first capture it to a digital stream using a device commonly called a scanner. At that point it is digital and your question becomes, "How do I convert one image data format or encoding to another format or encoding using the C language?"

If it is already a digital photo, then it is already... digital, and the question is the same, how to change encoding.

So the basic question, after optional scanning to digital format in the first case, is the same.

Your question as asked has no answer. You must first specify the source encoding and the desired output encoding. It would be helpful if you would describe more completely what you are actually trying to accomplish.

Please see this page, and follow the links at bottom of that page, for guidance in asking a complete question.

And welcome to LQ!
 
2 members found this post helpful.
Old 05-05-2017, 03:29 PM   #3
lumbut
LQ Newbie
 
Registered: Apr 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
astrogeek, thank you and sorry for my incomplete question,
I have a photo of rose and want to
for example:
dot A is at x, y and the color is red (100x, 100y, red)
dot B is at x, y and the color is red (50x, 50y, green)
dot (0x, 0y, white)
and so on.
and save all points in an array.
please see the photo
http://imgur.com/a/MkiUa

Last edited by lumbut; 05-05-2017 at 03:30 PM.
 
Old 05-05-2017, 04:08 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
There are MANY different image formats out there...jpg, png, gif, tiff, bmp, the list goes on and on. Do you want to support them all? Just one? Which one(s)? Most image formats are compressed to save space, so reading it is not just a simple binary parse of the data file. You could use a 3rd party library to read it, or you could use an image conversion tool (eg: imagemagick) to convert to something simple (eg: bmp) and then parse it yourself.
 
Old 05-05-2017, 04:18 PM   #5
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
Using PNG is readily portable and working anywhere.
herewith a tutorial example : https://github.com/spartrekus/lodepng
I can give you some tutorial example if you need, using GCC and very simple to use.

xbm file format is also nice since it works on Unix well.
 
Old 05-06-2017, 01:35 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by lumbut View Post
I have a photo of rose and want to
for example:
dot A is at x, y and the color is red (100x, 100y, red)
dot B is at x, y and the color is red (50x, 50y, green)
dot (0x, 0y, white)
and so on.
and save all points in an array.
please see the photo
http://imgur.com/a/MkiUa
so it is already digital.
what you describe sounds like a simple bitmap format.
why do you want to reinvent the wheel?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Labelling digital photo collection General General 7 09-04-2007 06:31 AM
digital photo connected via IEEE 1394 AchimRS Linux - Hardware 8 02-23-2007 03:58 PM
how can i print digital photo with i455? bravehao Linux - Software 1 10-16-2005 06:24 AM
Online digital photo printing kadissie General 1 05-26-2005 08:29 AM
panorama software for digital photo topche Linux - Software 1 08-03-2004 09:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration