473,387 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

to find a red dot in bmp file.....

hi all....

there is a bmp file which has a black background and has a red blot(dot) in the middle(i cant exactly say).....how can i find the coordinates of the red dot....
any code ll be appreciated....

Thanks
Ranjit
Nov 22 '06 #1
12 2939
sivadhas2006
142 100+
Hi Ranjit,

You have a bitmap right.
Can I know the type of the bitmap?

The following are the bitmap types.

1. Monochrome.
2. 16 Color.
3. 256 Color and
4. 24 bit.

Note: For each type we want to fetch the pixel values differently.

Regards,
M.Sivadhas.
Nov 22 '06 #2
hi...

the bitmap is of 24 bits......(640x480-bmp)


Thanks
Ranjit
Nov 22 '06 #3
sivadhas2006
142 100+
Hi Ranjit,

For 24 bit bitmap,
The pixel value range is 0 to 16777216.

Can you able to get the pixel values from the bitmap?

If yes, give some sample pixel values you got.

Regards,
M.Sivadhas.
Nov 22 '06 #4
hi...

file size=921654
offset=54
bmpheader size =40
width=640
height=480
size of bmp data=921600
pallette=1164991813...

Thanks
Ranjit
Nov 22 '06 #5
sivadhas2006
142 100+
hi...

file size=921654
offset=54
bmpheader size =40
width=640
height=480
size of bmp data=921600
pallette=1164991813...

Thanks
Ranjit
Hi Ranjit,

Thanks for giving information.
Whatever you are given is correct.
I think we need to concentrate on the pallette information.
Can you give some more samples about palette information?

Note : We need the palette information in the RGB format.

Regards,
M.Sivadhas.
Nov 22 '06 #6
hello....

i have uploaded the photo in this link sir.....i am not able to make out what u are asking....plz tell me if u happen to find out....plz tell me how to find what u are asking....sorry for my ignorance....

Your Download-Link: http://www.uploadwiz.com/WIZ541902715

Thanks
Ranjit
Nov 22 '06 #7
sivadhas2006
142 100+
Hi Ranjit,

Let as assume a matrix of size 640x480.

So you must have 307200 pixel values.
I just need the pixel values to find the red dot in the black background.

Note :The URL you have posted is not working.

Regards,
M.Sivadhas.
Nov 22 '06 #8
hi....

ok ok...i got it....it is 68154.....


Thanks
Ranjit
Nov 22 '06 #9
sivadhas2006
142 100+
hi....

ok ok...i got it....it is 68154.....


Thanks
Ranjit
Well.
First Convert the color pixel values to grayscale values.

Expand|Select|Wrap|Line Numbers
  1. nGrayScaleValue = R*0.3 + G*0.59+ B*0.11;
  2.  
Regards,
M.Sivadhas.
Nov 22 '06 #10
hi...


thanks a lot...can i know how u came up with that..???


thanks
Ranjit
Nov 22 '06 #11
sivadhas2006
142 100+
hi...


thanks a lot...can i know how u came up with that..???


thanks
Ranjit
Hi Ranjit,

Well,
Can you post your code, whatever you have finished upto now?

Regards,
M.Sivadhas.
Nov 22 '06 #12
#include <stdio.h>
#include <dir.h>
#include <graphics.h>
#include <stdlib.h>
#include <conio.h>

#define NO_OF_PIXELS 24
main(int argc,char **argv)
{
struct ffblk *ffblk;
char ch;
FILE *fp,*fp1;
unsigned char color[3];
long int i = 0,j = 0;
int x =0,y =0;
int pixels,done;
long colorval= 0;
pixels = NO_OF_PIXELS;
if(argc > 1)
pixels = atoi(argv[1]);
ffblk = malloc(sizeof(struct ffblk));
done = findfirst("*.bin",ffblk,0);
fp = fopen (ffblk->ff_name,"rb");
fp1 = fopen("a.csv","w");
while(!feof(fp) && !kbhit())
{
fread(color,1,3,fp);
if(color[0] > 0xf9 && color[1] > 0x00 && color[2] > 0x00 && color[0] < 0xff && color[1]< 0x9f && color[2] < 0x9f){

fprintf(fp1,"%ld,%d,%d,%d,%d,%s\n",i%pixels,(int)( i/pixels ),color[0],color[1],color[2],ffblk->ff_name);
j++;


i++;
}
fclose(fp);



here i am checking for the condition if the red color can be spotted(i have converted the bmp file into its binary file.....)...but i am not able to find the coordinates of where it is found....
Nov 22 '06 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: hokieghal99 | last post by:
import os, string print " " setpath = raw_input("Enter the path: ") def find_replace(setpath): for root, dirs, files in os.walk(setpath): fname = files for fname in files: find =...
6
by: Peter Hansen | last post by:
Greetings. Im trying to write a program that can be run from the command line. If I want to search for example after a file with the ending .pdf, I should be able to write in the command line:...
1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
1
by: Pierre-Yves | last post by:
Hello, I have to loop recursively in directories to build a tree. Based on the directory name, I know I can skip some (i.e: the BACKUP ones) to improve the performances that are currently very...
1
by: Dan Jones | last post by:
I'm writing a script to process a directory tree of images.  In each directory, I need to process each image and generate an HTML file listing all of the images and links to the subdirectories....
5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
0
by: Michael R. Pierotti | last post by:
Has anyone seen this error before when trying to make the install on a program. ------ Starting pre-build validation for project 'HafaSMPPInstall' ------ WARNING: Unable to find dependency...
0
by: Xah Lee | last post by:
Interactive Find and Replace String Patterns on Multiple Files Xah Lee, 2006-06 Suppose you need to do find and replace of a string pattern, for all files in a directory. However, you do not...
5
by: peter | last post by:
Hello all, I'm looking for an advice. Example (one block in ascii file): $------------------------ NAME='ALFA' CODE='x' $------------------------
3
by: mouac01 | last post by:
Newbie here. How do I do a find and replace in a binary file? I need to read in a binary file then replace a string "ABC" with another string "XYZ" then write to a new file. Find string is the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.