?
Solved

HARD!! getting/changing data in bitmap image

Posted on 2003-10-21
13
Medium Priority
?
247 Views
Last Modified: 2012-06-27
Hi experts,
     I have a question that should set you thinking.

     I have a bitmap(a picute I took with a digital camera) that has some writing on it, well its a picture of some writing.  The problem with the photo is that the background is a kind of yucky grey/brown colour, though i wrote it on a clean WHITE peice of paper.

I want to write a program that makes the background colour a colour of the users choice.

I don't even know where to start writeing this, can some one help?

thanx,
     Boyidiot
0
Comment
Question by:Boyidiot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
13 Comments
 

Assisted Solution

by:eliaslopezgtz
eliaslopezgtz earned 200 total points
ID: 9595227
try using the win32 api...
setpixel... getpixel...
that would be the fastest way to do ...
but you need to get used to handles.. and things like that...
0
 

Author Comment

by:Boyidiot
ID: 9595275
yes I could do that I could get the user to select the back colour on the picture then change/blankout all the pixels with that colour, but the background colour isn't the same colour.

hmmm, I could get the user to select the text colour(at its lightest), then only keep the pixels that are darker than it.

Could you help me put it into code, I dont know how to use Setpixel/getpixel.
thanx

 Boyidiot
0
 

Expert Comment

by:eliaslopezgtz
ID: 9595400
Public Declare Function ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long
Public Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Public Type POINTAPI
    x As Long
    y As Long
End Type

this are the declarations
let me write some samples wait a sec...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:eliaslopezgtz
ID: 9595408
Private Sub draw_MouseDown(button As Integer, Shift As Integer, x As Single, y As Single)
    If button = vbLeftButton Then draw.FillColor = col1.BackColor
    If button = vbRightButton Then draw.FillColor = col2.BackColor
    Dim m As POINTAPI
    m.x = x / 15
    m.y = y / 15
    p = GetPixel(draw.hdc, m.x, m.y)
    ExtFloodFill draw.hdc, m.x, m.y, p, 1
    draw.Refresh
end sub
0
 
LVL 10

Accepted Solution

by:
cool12399 earned 200 total points
ID: 9600471
Also...

Just so you are aware -- the programming task will be a little more challenging than you think,
you will either need a little bit of mathematics background, or someone who does. The image
will not have a 'uniform' yellow color, so you will have to test for tolerance as well if you use
some kind of flood fill routine, which means you'll have to write your own routine to make it
look right. Otherwise -- what you'll see -- is basically an image, still with some yellow, and some
of the yellow pixels whited out. And you can't simply change all 'yellow' pixels, in case the 'image'
has yellow color in it...

So it'll be a little harder than you expect.
0
 

Author Comment

by:Boyidiot
ID: 9603734
thanx for the advice, I'm gonna make sure though that the write be in black/blue, a dark colour.

'you will either need a little bit of mathematics background'- How much?

0
 

Expert Comment

by:eliaslopezgtz
ID: 9607388
or maybe if you want...
http://graphics.lcs.mit.edu/classes/6.837/F00/Lecture04/

best regards and don't forget to accept an answer
0
 

Author Comment

by:Boyidiot
ID: 9609832
I wont forget, I'm just gonna give it another couple of days or so
0
 
LVL 10

Expert Comment

by:cool12399
ID: 9610148
how about giving me the points?? :)
now *theres* good advice!

to do it correctly (make it look good), you will either need a fair amount, or
hire someone skilled to do it. a simple flood fill will not work (will only do adjacent pixels
of the same color).

0
 

Expert Comment

by:eliaslopezgtz
ID: 9610380
you are right... help us please
0
 

Author Comment

by:Boyidiot
ID: 9620675
well I've done it, it just needs abit of tunig to get it perfect, but I DID IT!!!

heres how,

i've got two pictureboxes one with the picture in it. then the user selects a colour, It splits that colour into RGB, then the program gram goes through each pixel(about 10000 a second) and sees if its darker or lighter than the set colour. If it is darker it transfers it to the other picturebox.

well thanx guys
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question