|
This is not a homework.this is a predefine formate which we have to follow. I have finished most part of this question like getting data from the PGM file , now i am looking to implement the PBM file .
|
|
|
|
|
Ok, but what forbids you to use external C libraries ? This will be much more efficient than redoing everything yourself.
On the other hand, if you really want to code everything yourself, you can simply look for the PBM file format[^]
|
|
|
|
|
|
It looks like a very simple file format. What is your trouble with?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
if i have understood your problem correctly then it is only with writing bits and hexa values to a file.
if iam right, then please specify your task clearly. we shall attempt it.
did you mean to convert the 0x80 to bits or vice versa?
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
please detail your problem to manipulate on bits and hexas.
like what is the input you are getting from source file and how you want it to be written to the dest. file.
an example would be apprieciated.
as Cedric Moonen said, hexa,decimal,binary are only our interpretations. the data that will be stored in memory will be any way 0s and 1s.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
singh.vikas8508 wrote: I am getting binary data of PGM file.
how are you getting it? i mean if you have got a byte, does it contain one pixel information or one full row(6 pixels in you 'J' example case)
singh.vikas8508 wrote: I have got height and width of this PGM file.
good
singh.vikas8508 wrote: I need to write PBM file of that data.
what should the first byte of that pbm file contain apart from header in your 'J' example case.
singh.vikas8508 wrote: I will have a threshold value on the basis of that value I can put 0 and 1 into the PBM file.
what is this threshold value again?
unless your question is very specific, it cannot be attempted. try to put your post into different words than those u used in the earlier posts.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
I think your biggest trouble comes from the fact that you don't really understand what hexadecimal notation really is. Hexadecimal is just used as a representation for data: a number can be represented in hexadecimal, deciaml, binary or whatever but the number itself is always the same (and has nothing to do with its representation). So, you don't 'write' hexadecimal data to a file, you just write data to it.
|
|
|
|
|
singh.vikas8508 wrote: 1.)I have never deal in writing a hexadecimal format. means 0x80.
You probably have to use a binary encoding. Hexadecimal , on the other hand is just a convenient number representation. For instance 0x80 is 128 or 1000000b that means the leftmost pixel ON in your image (that means you've to assign the 128 value to the first byte of your file, i.e. binary encoding).
singh.vikas8508 wrote: 2.)I need to perform logical operation with this hexadecimal formate.
You need just to manipulate byte and bits.
singh.vikas8508 wrote: 3.)How I can insert bits in this format. like this.....as an example.....01100101
As I said before, hex is a convenient numeric representation, for instance you can easily translate this bit pattern in hex (just transform 4 bits at time into an hex digit: 0110->0x6 , 0101->0x5 hence 01100101->0x65 ) that means you should write 0x65 to the file.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well, if you must (homework, as Cédric guessed?) implement it then have a look at the documentation PBM, PGM, try to code it and ask here when you've specific question.
(Actually
singh.vikas8508 wrote: I mean how to deal in writing a hexadecimal values 0x80.
How to create a new byte.
look like specific, but, as they stands they're quite 'ununderstandable').
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It seems quite clear from this article[^] that you have to select some greyscale threshold to determine how to convert greyscale to black and white - is that where the 0x80 comes from?
The 'extra value' in the second line of a file in PGM format indicates the maximum pixel value in that PGM file. I'd use 50% of that as the threshold value, rather than 0x80.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
singh.vikas8508 wrote: I mean how to deal in writing a hexadecimal values 0x80.
Are you referring to something like:
fprintf(file, "%#x", 0x80);
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All,
I have an application that should not allow the user to open the Available Networks Window (specific on Vista/Windows &). Is there an API option to do this. When the user right clicks on the Windows Network menu, this option shouldn't be displayed.
Thanks in advance.
Sunil
|
|
|
|
|
Hi,
Can someone tell me how to call window service created in VC++ 9.0 in VC++ 6.0?
|
|
|
|
|
rana ray wrote: window service
Do you mean a Windows service[^]? Because you don't call those directly, IIUC....
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
rana ray wrote: Can someone tell me how to call window service created in VC++ 9.0 in VC++ 6.0?
are talking about source code or actual executable
Raman Tayal
Microsoft Certified Technology Specialist in BizTalk Server 2006
Microsoft Certified Application Developer .NET
My Blog: - http://ramantayal.blogspot.com/
|
|
|
|
|
I can tell you the actual thing, I need to create a window service in VC++ 9.0 which contains database operations and i will call it from VC++ 6.0 COM dll. I am wandaring how to call a window service from VC++ 6.0?
Need help on this.
|
|
|
|
|
We must write file very fast ,so writing speed is no less than 150MB/s.RAID0 is used for raise writing speed.I should create the file with the flag FILE_FLAG_NO_BUFFERING on the beginnging sectors of the disk to ensure so fast writing speed.I use WriteFile to write data.But the writing speed is not stable.Sometimes the speed will reduce to 50MB/s.It seems that when this occurs,the system is busy.
Can anyone can tell me something about this?Any information is appreciated.Thank you.
PS:I use VC8 and the OS is WinXP SP3.
|
|
|
|
|
what is the write speed supported by the RAID controller?
try with other flags also.
what is the size of the buffer you are using in your code?
|
|
|
|
|
Thank you for your reply.Well,the RAID controller supports the write speed is no less than 300MB/s.The buffer is 200MB,but each time I write 731136 bytes.Other flags are not suitable for our project,so I can't use other flags.
|
|
|
|
|
denghp wrote:
I write 731136 bytes
any special significance of this figure?
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
This num is multi-time of 512 bytes and it is the size of data I want to write.
|
|
|
|