Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Calculating No. Of Pixels In A Character


Is there a way to calculate no. of pixels in a character? For example the character . (dot) is made up of 1 pixel.
So I want a technique where by I give program the character let's say g and then it calculates the pixels this char is made up of.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Calculating Total Black Pixels In An Image
this is the algorithm for calculating black pixels and then finding them recursively in the image...how do i change it into a VB program?



Code:
//tests if a pixel is black
/*==============================================================*/
bool IsBlack(int row, int col, LPVOID BaseAddress)
{
//a pixel’s RGB val is returned
COLORREF* pPixel = ((COLORREF*) BaseAddress) + row * 640;
COLORREF curPixel = pPixel[col];

BYTE red = GetRValue(curPixel);
BYTE blue = GetBValue(curPixel);
BYTE green = GetGValue(curPixel);

int black = 150; //RGB value to determine if Pixel is Black

//returns black if RGB vals < highest acceptable black val
if (red < black && blue < black && green < black)
{return true;}
else
{return false;}
}

Code:
MapPattern(row, col)
{
/*Checks the above pixel if it is black and unmarked, if it is then the pixel is flagged */
/*into the Points structure and the MapPattern function is run with the above pixel */
/*as the parameter*/
if (Field[row–1][col] = black AND Points[row–1][col] != 1)
{
Points[row – 1][col] = 1
MapPattern(row – 1, col)
}
/* The same process checks the pixel beneath the input
location (note the statement checks if the pixel is pre-
existing before reentering the recursion*/
if (Field[row+1][col] = black AND Points[row+1][col] != 1)
{
Points[row + 1][col] = 1
MapPattern(row + 1, col)
}
/*Checking the pixel left*/
if (Field[row][col–1] = black AND Points[row][col–1] != 1)
{
Points[row][col – 1] = 1
MapPattern(row, col – 1)
}
/*Checking the right pixel*/
if (Field[row][col+1] = black AND Points[row][col+1] != 1)
{
Points[row][col + 1] = 1
MapPattern(row, col + 1)
}
}

Calculating Number Of Black And Red Pixels In A Image
hi..can anyone help me with the code to count the number of red and black pixels in an image? Pls reply as soon as possible. Really appreciate it

this is the algorithm for calculating black pixels and then finding them recursively in the image...how do i put it into VB?

Code:
//tests if a pixel is black
/*

Twips,character,pixels
hi,

can any body tell me the calculation for twips,character,pixels ,etc...

i.e
1 pixel = ?
1 twip = ?
and so on

Brgds

Encryption- How Can I Read From Files One Character At A Time And Output 1 Character
and output one character at a time. I already have the algorithm.

Change Text Color And Font Character By Character
Hi,

Is there a way to change a single line of text, making half, one color and the other half a different color in bold?

Number of files (150) (150)

How To Read Character After Character In A String?? Pease Help
Hi ,
I just can't find a way to read a string character after character ,
and I want to check each character.
On every single character i wanna do een IF-statement.
Anybody can help please?

Thanx !!
Qman

Reading A Text File Character-by-character
Hello

Can anyone tell me how to read individual characters from a text file, please. I need to perform substitutions on certain characters so need to be able to test each one as it is read from the file.

Thanks
Andy

Display A File Character By Character In Text Box?
I have opened a file as follows and used "Common Dialog Control" (CD1). Now, I want to display the opened file character by character in a Text Box.

I have done following, but it is displaying just few first characters or the last ones.
------------------------------
CD1.ShowOpen
Text1.Text = CD1.FileName

Open Text1.Text For Input As #1
Do While NOT EOF(1)
Input #1, c
Text2.Text = c
Loop
Close #1
--------------------------------

Find Character Not In Ansi Character Set With InStr
hi,

im using the InStr function to find the beginning and end of a string then using the Mid function to get the string. i can do everything fine except finding the end of the string.
i know how to use the InStr function fine, its just i dont know how to find one of those characters that are defined by a solid block in text editors (example). vb wont let me copy and paste the block character into it.

i could go through all 220ish ansi characters checking to see that it isnt any of those, but the file that i am searching through is currently 600kb and always rising and the strings are usually at least 20 characters long, so it would be more processorage intensive than i would like.

the relevant code i have at the moment is

Code:
If InStr(1, templine, "Visited: ") <> 0 Then
StartHere = InStr(1, templine, "Visited: ")
EndHere = InStr(StartHere, templine, "ARARARARARA")
End If


if anybody could give me a some advice on finding the position of this mystery block through InStr or otherwise i would appreciaite it. even a totally different approach to finding what is between the "Visited: " string and the first strange block in a file layed out something like this would be really nice.

long-winded me

Match ANSI Character To Chinese Character
Hi Guys,


Here is my problem

I have some character let s say 其它 and their respective C6E4 CBFC and
C6 =>
E4=>
CB=>
FC=>

I believe this is DBCS to ANsi

Now i need to do the reverse function. I can get the hexadecimal code C6E4 which is 其 in Simplified Chinese Codepage 936. Having the hexadecimal value, how can i get the right character ?


THanks a million
Olivier

Reading A File Character By Character Limitations
I am writing a SGML parser, and am trying to read in a .sgm file character by character so that I can check for the tags and such. I only need 2 specific child elements per parent element, so it doesnt have to be very sophisticated. Anyway, every time I try to read in a file basically using


Code:
Open sParseFilePath For Binary As 1


It works fine, until it hits around 4638 or so characters, then stops reading. Is this a limitation?

Any other suggestions on how to do this parser?

Thanks...

Inserting A Character After Every Character In A Textbox
Hello all!

I have a problem which I hope someone could help me to solve, after searching here I couldn't find what I need though

I have textbox and a button on my form, and on the buttons click event, I'd like to assign the contents of Text1 to the variable newname, after inserting a character (in this case the letter "o") in between each existing character.

To explain more clarly - if I had entered the word TEST into the textbox, then clicked the button, the variable newname would then be "ToEoSoT".

I have little experience using For, Next loops, which I assume is needed? So I think this is a good oppertinity for me to learn

Thankyou in advance

How To Read .doc File Character By Character??????
I want to read the .doc file using VB.... Will you plzzz guide me how can I read the file character by character so that i may read the specific location of the file..............

Read A File Character By Character
How would I go about reading the first character in VB from a file, then doing something with the character, reading the next character, etc.? I know how to open the file, but I don't know if there's a special mode to do it, or anything.

How To Search A String Character By Character
Hi everyone,

Need to be able to search a string and compare each character to a list of valid characters.

example:
string1="vb-programming"
string2="vb=programming"
valid characters are a-z, A-Z, 0-9, _, -, .

this would find all these characters valid in string1 to be valid and find "=" in string2 to be invalid thus making that string an invalid string

any help or direction would be appreciated

btw i have been trying to use instr functions to accomplish this and have only been able to search
for "1" character at a time

thx harold

Reading A File Character-by-character
Hi guys

Is it possible to read a file in VB(text file ofcourse)
character-by-character, the way we do it in C ?


Thanks

Suhaib

How To Convert Upper Case Character To Lower Case Character?
Hi ,
I would like to know how to convert upper case character to lower case character. Because i am doing simple search engine. It has case sensitive.
For example, there has a keyword "Automation" in my databse, but if i type automation ,it could not be searched. just only can type Automation.
How can it automatically convert "A" to "a" then the rest of character remain the same?so that when i type automation ,it will be detected .Does anyone can help me? Can use If..Else method?



Regards,
xin xin

Pixels
How can I make my program find out the number of pixels a certain picture file has? And does it work the same way to GIFs and BMPs?

Pixels In A Row
any ideas on how to go through the pixels (checking for a certain condition) in a single row or colum of a picture box .
or even a link so i could figure it myself

Pixels To Cm.. OO
Hi,
How can i convert pixels to centimetre? (Dont ask why i want to find it out )

Pixels? What Pixels?
Why doesn't Visual Basic use Pixels? My width is: 13530, and my height is: 10605. Does anyone know what this is, and how I can make an 800x600 window? just for the record, I have VB6 Enterprise.
Thanks,
-Gaz

Pixels
NOW THIS IS JUST GETTING ANNOYING!!!!!
My form has a scalemode of pixels.
I added a frame to the form
Everything I have in the frame, the scalemode is automatically twips.
I CAN'T WORK IN TWPS!
The program I am making is very graphical and I need to work in pixels, and timesing everything I do by 15 is just going to get confusing. Is there any sort of magic button that I can press that makes the default of all new objects to be measured around in Pixels?

Pixels
I'm annoyed. I never use twips ever ever, and in Visual Basic, thats what it keeps using.
I changed the scalemode of the form to pixels, and I added a rich text box, but when I resize it, it resizes in twips! How can I change that?

sorry if this turns up in the FAQs, I pressed the wrong button by mistake!

Get Pixels
i am starting work on a new project to create image reccognition software. i just wondered how to get the number code for a certain point on the screen. i've heard of GetPixels but i'm not sure how to use it
thanks guys

How Do You Use An Of Pixels As A HDC?
VB Code:
Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Integer



I hear you can use an array of pixels aswell as a DC for hSrcDC!

Some one please show me how...

Pixels
I want be able differentiate between different sentences in an image which I have scanned on to an image object. I know it is sometime to do with the pixel location and the getpixel event. Is there anywhere where i can find out more or does anyone have any ideas.

Pixels To Cm?
What code is required to convert from pixels to cm

Two Odd Pixels...
I am using the following code for a status bar which shows the progress of the app's loading. picBox is a normal picturebox. I call NextStage when a form has loaded (with DoEvents). Everything works fine except there are two annoying grey pixels in the picturebox (as shown in the screenshot): one in the bottom left corner the other in the bottom right. Any suggestions? Or will I have to use PSet to colour those two points?


VB Code:
Private Const stages As Single = 4Private curPerc As SinglePrivate Const stageParts As Single = 100 / stages Private Sub DoPercent(lPercent As Single)    picBox.Scale (0, 0)-(100, 100)    picBox.Cls    picBox.Line (0, 0)-(lPercent, 100), &H800000, BF    picBox.CurrentX = (picBox.ScaleWidth - picBox.TextWidth(CStr(lPercent & " %"))) / 2    picBox.CurrentY = (picBox.ScaleHeight - picBox.TextHeight(CStr(lPercent & " %"))) / 2    picBox.Print CStr(lPercent) & " %"End Sub Private Sub NextStage()    curPerc = curPerc + stageParts    DoPercent curPercEnd Sub

Pixels
How do I plot pixels directly onto my VB form? I know how to use LINE and CIRCLE commands but nothing I've tried will plot pixels!

Thanx

Pixels
Hi!
I just got VB6 Pro and I can't find anything to change default
units from twips to pixels. Please help!

Celery

Pixels
How do a put a single pixels on the screen. Is there a pixel(x,y,colour) style of function? (similar to Line)

Cheers

Pixels
How to draw a horizontal line on a tiff image, also once the line is drawn , all the portion above the horizontal line have to saved as a different file on the hard disk.

Pixels
How to draw a horizontal line on a tiff image, also once the line is drawn , all the portion above the horizontal line have to saved as a different file on the hard disk.

Pixels
On right click of the mouse a horizontal line has to be drawn, this way any number of line should be drawn on one image, also the exact location of the mouse click should be shown as pixels in a text box, for ex: 348, and by left click of the mouse on the line, the line should should be dragged up/down on the image with the corrosponding pixels shown in the text box, also the text box should be editable for eg if we input a number on the text box the horizontal line should be moved to the new location.

Pixels
On right click of the mouse a horizontal line has to be drawn, this way any number of line should be drawn on one image, also the exact location of the mouse click should be shown as pixels in a text box, for ex: 348, and by left click of the mouse on the line, the line should should be dragged up/down on the image with the corrosponding pixels shown in the text box, also the text box should be editable for eg if we input a number on the text box the horizontal line should be moved to the new location.

Pixels , How Do I Say Where?
what code could i use to tell VB where to place a pixel on a form or pixture box or image or something along those lines?
thanks in advanced


------------------
[]D Y R o

Pixels , How Do I Say Where?
what code could i use to tell VB where to place a pixel on a form or pixture box or image or something along those lines?
thanks in advanced


------------------
[]D Y R o

Help Me With Pixels
Hi, I am very much interested in doing graphics using pixels. The problems is that i donno anything about it..how it works..how to make it work according to our requirements...i am bling in this concept. Can anyone pls. tell me how it works with an example..
That would be of great help to me.

Regards Venkat

Counting Pixels
hi..can anyone help me with the code to count the number of red and black pixels in an image? Pls reply as soon as possible. Really appreciate it
this was a program we managed to come up with in C program..cos tats the only programming language we were thought in sch...is it possible for someone to help us to convert this to VB?but this is only for a pixel in the picture...but we want an overall calculation for the whole image...i think we have to loop it and use count and all..but really dun know how to get to go about it..
void get_icolumn(HWND hWnd, imgdes *image, int xx, int yy)
{
#define GET_BLU(c) (int)(((c) >> 16) & 0xff)
#define GET_GRN(c) (int)(((c) >> 8) & 0xff)
#define GET_RED(c) (int)((c) & 0xff)
long color;
int red, grn, blu;
char szBuff[80];
char *str;

color = getpixelcolor(image, xx, yy);
if(color >= 0) { // Indicates no errors
if(image->bmh->biBitCount <= 8)
wsprintf(szBuff,
"Color value at (%d,%d) is %d, %d bpp", xx, yy,
(int)color, (int)image->bmh->biBitCount);
else { // 24-bit image
blu = GET_BLU(color);
grn = GET_GRN(color);
red = GET_RED(color);
wsprintf(szBuff, "Color value at (%d,%d) is red: %d, "
"green: %d, blue: %d, %d bpp", xx, yy, red, grn, blu,
(int)image->bmh->biBitCount);
}
MessageBox(hWnd, szBuff, 0, MB_OK);
}
else { // Error if color < 0
switch((int)color) { // Assign error message
case BAD_RANGE: str="Range error";
case BAD_BPP: str="Bits per pixel not 1, 8, or 24";
}
MessageBox(hWnd, str, 0, MB_OK);
}
}

How Many Pixels Are There In A Twip?
How many pixels are there in a twip?
MSDN crashes every time I try and open one of these help files

Thanks

What's The Point Of Pixels?
Ok, I've swallowed my pride after hours of searching on this site and the wider web - I'm reasonably certain that my search criteria are to blame, so please excuse me if that's the case...

Without using the built-in functions of VB, how can I determine how many Pixels constitute 1 Point? I've gathered that this depends on things such as screen resolution, and the only methods I've seen (in other dissimilar languages) refer to a font character as a point of reference.

I'm attempting to do some API-based form manipulation in VBA (yes it is possible) but the API's require pixel units. The only conversion method from the Points measurement (as returned by VBA screen dimentions) are VB-only functions.

So is there an algorithm to do this?

Pixels In An Image!
Hi everyone
I have a picture box in VB and what I want is when I click somewere on the image, I want a message box to pop up showing the RGB value of whatever colour i click on in the image!

E.G
If I click on a red part, then msg box says "RBG: 255,0,0" etc....

Any info?? I think someone mentioned using GetPixel?

Thanks!

Bitmaps And Pixels
I got a huge picture I load into a image (a map). How can I show parts of it using pixel coordinates? E.g I know I want to start looking at 400x250 and stop at 500x450 ? PaintPicture looks like it but I can't figure out how to retrieve the pictures width and height.

Pixels To Inches
Hello, I have a couple of questions concerning printing images to scale. I have a program I made that displays a graph of a spiral on the screen. When I run my equations in the program, I use pixels as my units of measurement, and the graph ticks are also marked off in pixels. But I also want to be able to have the user enter equation parameters in inches and have the graph image display the tick marks in inches and print off in inches as well. I looked around for conversion formulas and some were talking about how you have to take the DPI of the printer into consideration. Im just curious to know if there is an easier way to converting the pixels to inches and have the image graph print out in inch units on the real paper. If this sounds a bit confusing, I can elaborate on it if someone responds.



Thanks,

Jason O

Twips To Pixels
Does anyone know the conversion from twips to pixels?
Dan_

Pixels Wiped?!?
Hi,
the problem i have is when i use setpixel or pset to draw a picture in a picture box, the new pixels dont stay there. For example if i drag the form with the picture box of the screen then back on the pixels are wiped away and i'm left with a blank picture box.

I don't want to save the picture but just want to prevent the created picture from being wiped clean if the user drags it of screen or moves another form in front of it.

is there any way of doing this ??

thanks for any help.

Compairing 2 Pixels
I am trying to compare 2 pixels to see how close they match.
If they are close enough I consider them a match.
Unfortunately it doesnt work. Any help would be Great

This code is modified from GavinO's edge finder filter. His code works vary well!

Tweako = (.Label1.Caption)
ttly = 0:tlu = 0:ttlv = 0

r = PixelRed1
g = PixelGreen1
b = PixelBlue1
Y = 0.3 * r + 0.6 * g + 0.1 * b
u = b - Y
v = r - Y
ttly = ttly + Y
ttlu = ttlu + u
ttlv = ttlv + v

r = PixelRed2
g = PixelGreen2
b = PixelBlue2
Y = 0.3 * r + 0.6 * g + 0.1 * b
u = b - Y
v = r - Y
If Y - ttly > Tweako Or u - ttlu > Tweako Or v - ttlv > Tweako Then Match = False Else Match = True

Access To Pixels In JPG
I want to convert a stream of real time stereo jpgs into a series of contour maps showing the distance to each pixel ( PointGrey offer a standard product that does this but it is not open source so I cannot "mess" with it)

My guess is that I will need to convert each jpg into a bitmap first unless there is an easy way to access a specific pixel in a jpg? Does anybody have VB6 code that does this or will do the conversion to bmp?

If anybody has code that does the contour stuff that would be even better ....

I need as much access and flexibility as possible as I am not totally sure how this project will develop.

Pixels In Circle
Is there anyway to generate an array of pixels (x,y) for every point inside of a circle? for instance the array would be something like Point(1).x and Point(1).y and would contain every pixel cordinate within the circle. If this is not possible how can I calculate whether a point is in a circle or not?

Copyright 2005-08 www.BigResource.com, All rights reserved