|
White is when all the bits are turned on. If you don't have any whites, your algorithm is obviously wrong, or the source image has no whites.
How are you displaying a 48 bit image ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I am using a 48bit bitmap handle all the time when i am cerating and manupulating with 48bit bitmap. Coming to displaying the image.. i am sure tht the display shows only 256 greaylevels.. but i can see the difference between the two images, one converted into 24 bit (8/8/8) and the other one 48bit (16/16/16).. becos i think it is due to clipping...in 24 bit we are forcing 12 bit information into 8 bit where we would loose some greylevel info.. but in 48 bit we are not lossin it and the display maps itself to 256 greylevels.
Now I hope, 'm getting all greylevels.
Is wht I am thinkin is right?
thanks and lookin forward to discuss with you on more issues,
Suman
|
|
|
|
|
If what you get is different between the two, your algorithm is wrong. You still can only display 256 grey levels, less than you are trying to put into both images. Therefore, if there's a visible difference, you're doing it wrong.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hmm... but i don't know how to tell tht the image i am displaying is right or wrong.
here is wht exactly wht i am displaying. I am displaying a radiograph of spinal cord. When i am viewing it in a 24bit format, I can barely see 3-4 vertebrae outlines, but when i display it in 48bit, then there is improvement, now i can see around 4-6 vertebrae outlines, without loss of any of the previous information ( i mean the information which we can see in a 24bit).
Anyway.. how can i crosscheck my code whether wht it is doin is right or wrong..?
Suman
|
|
|
|
|
Suman Somanchi wrote:
Anyway.. how can i crosscheck my code whether wht it is doin is right or wrong..?
Compare it to the original image ?
By the way, you need to be doing some pretty funky image processing to care about those extra four bits. Create a Bitmap object, draw on it in black, and then draw some shapes using the grey level of 1. In other words, the colour is 1, 1, 1. Can you see the shapes you've drawn ? That colour difference is greater than the most significant piece of information you're retaining by going to 48 bit.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
yeah we have to compare with the original image.. but i am not able to display the originalimage as it is in raw format and is of some extension (*.LL1/*.LT1), for which as far as my search, didn't find an editor to display them.
Yep u ar right, we can't view the difference between them and i too agree with it. But, I can't do anything since, I am a student and I have to do what my advisor says.. I am doin this to satisfy him.
But in my opinion... 24 bit images are well suited for humans to perceive the difeerence between all the greylevels and also to display the images.
Suman
|
|
|
|
|
Suman Somanchi wrote:
But in my opinion... 24 bit images are well suited for humans to perceive the difeerence between all the greylevels and also to display the images.
Yeah, well, 256 colour paletised images are equally good, being identical.
Suman Somanchi wrote:
but i am not able to display the originalimage
If your advisor expects you to be able to display an image that you can't even see to compare to, they should be pleased with whatever they get. If you can't see the problem in the code, tell them that you've done it, the 48 bpp looks better, which proves them right, then sit back and suck up the praise. If they're going to ask you to do it a dumb way and not give you the resources you need, then that's as much as they deserve. It sounds like the 48 bit image is the one that you're doing right anyhow, which makes sense as you're starting with 48 bits, it's obviously the conversion to 24 bits that you've screwed up.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi Graus,
If u don't mind. I am having another question. How can we draw a 3D surface plot in a c++ program. I am having the three (x,y,z) data generated in my program, but i don't know how to create a plot of them at runtime. I hope we have to create an activeX control to implement tht. But my program is a plain cpp program. At present i am writing all the data into a text file and opening it in an excel sheet seperately and then drawing the graph.
if we have to convert, how can we convert a plain cpp file to activeX and include tht functionality.
if u r familiar with this and r having some ideas, plz share with me...
thanks,
Suman
|
|
|
|
|
Suman Somanchi wrote:
how can we convert a plain cpp file to activeX and include tht functionality.
You want to turn your app into an ACtive X control, or you want it to consume an existing ActiveX control ? How will ActiveX plot 3D for you ? DirectX will, and the DirectX sdk has heaps of examples for you. I don't think you need direct X though, you need to do some reading on 3D math and then you can plot it yourself.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks Graus,
I will try to implement what u told and infact i am little bit aware of tht 2D to 3D geometry in my Computer Graphics course in my undergrad. For today I am stopping my programming, since I want to spend sometime on other subjects too. I will do it tommorow and let u know the improvements...
Suman
|
|
|
|
|
Hello there!
I´m having a problem here.
I have a xml file with many tags, and I only want to add information to one tag "<MediaInformation>". How can I read the file to that especific position and them add the text information "clip1.mpg".
Anyone can help me?!!
Thank you very much
|
|
|
|
|
The number of tags isn't so much an issue as the size of the file (tags names could be small, so the file could also be smaller). The easiest way is to load the document into an XmlDocument , use XPath to find the node, and add your node:
XmlDocument doc = new XmlDocument();
doc.Load("data.xml");
XmlNode node = doc.SelectSingleNode("//MediaInformation");
if (node != null)
{
XmlElement elem = doc.CreatElement("name");
elem.InnerText = "value";
node.AppendChild(elem);
} This is definitely only an example, though, since without knowing more about what you're trying to do I can make too many assumptions. If you're XML documents uses a namespace (typically a good idea if you allow for mixed schemas) then you'll need to use an XmlNamespaceManager , too. You can find more information and examples in the .NET Framework SDK.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
First of all, I want to thank you for your help.
But the problem continues... =/
My XML struct it´s like show below...
<Mpeg7>
<MultimediaContent>
<AudioVisual>
<MediaInformation>
</MediaInformation>
</AudioVisual>
</MultimediaContent>
<Mpeg7>
And I want to add the tag "<name>clip1.mpg</name>" to the media information.
I´m trying to do this way
XmlDocument doc = new XmlDocument();
doc.Load("data.xml");
XmlNode node = doc.SelectSingleNode("//MediaInformation");
if (node != null)
{
XmlElement elem = doc.CreatElement("name");
elem.InnerText = "clip1.mpg";
node.AppendChild(elem);
}
It seams that MediaInformation don´t exist because the program never enter in the if condition.
Do you understand what is the problem?!!!
Thank you very much
|
|
|
|
|
I can't really help you much because you need to encode your XML or check "Do not treat <'s as HTML tags" when posting.
Instead of doc.SelectSingleNode , use doc.DocumentElement.SelectSingleNocde . Sorry.
If that doesn't work, it's probably because your XML document is using a default namespace in which case - like I said in my first reply - you have to use an XmlNamespaceManager and pass that along to SelectSingleNode . Default namespaces aren't supported very well, so use prefixes (prefixes don't have to match the source documents; only namespaces have to match):
XmlDocument doc = new XmlDocument();
doc.Load("data.xml");
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("def", "yourNamespace");
XmlNode = doc.SelectSingleNode("//def:MediaInformation", nsmgr);
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
but I check "Do not treat <'s as HTML tags" !!!
Can´t you see the XML code?!! =/
I think that I´m not using any namespace.
But the node gives always null...
|
|
|
|
|
hello again, I´m trying to find what is my namespace, my xml is like this...
<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001" xmlns:xsi="http://www.w3.org.2001/XMLSchema-instance" xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001">
<Description xsi:type="ContentEntityType">
<MultimediaContent xsi:type="AudioVisualType">
<AudioVisual>
<MediaInformation>
you said to use this thing
nsmgr.AddNamespace("def", "yourNamespace");
but my namespace what is?!!
thanks
|
|
|
|
|
You should really read-up on XML. All the "xmlns" attributes identify XML namespaces. Without ":something" after it (a namespace prefix), it identifies your default namespace (the namespace to use when you have no prefix). Therefore, your namespace is "urn:mpeg:mpeg7:schema:2001" and you need to modify my code like so:
nsmgr.AddNamespace("def", "urn:mpeg:mpeg7:schema:2001");
XmlNode node = doc.DocumentElement.SelectSingleNode("//def:MediaInformation");
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
/ means root, so unless MediaInformation is the root element, this won't work. Dropping any preceeding / means that MediaInformation must be a child of the current node. // means search under any node.
Without seeing his XML there's no way of knowing.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1" ?>
<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001" xmlns:xsi="http://www.w3.org.2001/XMLSchema-instance" xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001">
<Description xsi:type="ContentEntityType">
<MultimediaContent xsi:type="AudioVisualType">
<AudioVisual>
<MediaInformation>
</MediaInformation>
<TextAnnotation>
<FreeTextAnnotation>
Fim da partida Andrejs Rubins.
</FreeTextAnnotation>
</TextAnnotation>
<Semantic>
<Label>
<Name></Name>
</Label>
<SemanticBase xsi:type="EventType" id="68">
<Label>
<Name> Fim da partida </Name>
</Label>
<Relation Source="4"/>
<Relation Source="82"/>
<SemanticPlace>
<Label>
<Name> </Name>
</Label>
</SemanticPlace>
<SemanticTime>
<Label>
<Name> 90 </Name>
</Label>
</SemanticTime>
</SemanticBase>
<SemanticBase xsi:type="AgentObjectType" id="4">
<Label>
<Name> Letónia </Name>
</Label>
<Agent xsi:type="OrganizationType">
<Name>Letónia </Name>
</Agent>
</SemanticBase>
<SemanticBase xsi:type="AgentObjectType" id="82">
<Label>
<Name> Andrejs Rubins </Name>
</Label>
<Agent xsi:type="PersonType">
<Name>
<GivenName>Andrejs</GivenName>
<FamilyName>Rubins</FamilyName>
</Name>
</Agent>
</SemanticBase>
</Semantic>
</AudioVisual>
</MultimediaContent>
</Description>
</Mpeg7>
Here´s one example of my XML, I want to add information to the MediaInformation element. But I don´t know what is my namespace... =/
|
|
|
|
|
I'm trying to invoke a Web Service that has been secured with Basic authentication. (Its a Java webservice running on JBoss).
When I try to access the web service I get a HTTP 505 error implying that the HTTP Version is incorrect, but I doubt it is.
Can anyone who has accessed secure webservices have a look at the following client C# code and tell me if it looks OK. I need to establish if its my client (C#) code thats wrong, or the server (Java) code. Is this the correct way to authenticate against a web service that uses BASIC authentication?
Thanks.
proxy.AdministrationWS admin = new proxy.AdministrationWS();
NetworkCredential creds = new NetworkCredential("username", "password");
admin.PreAuthenticate=true;
admin.Credentials = creds;
try
{
String name = admin.DoStuff();
MessageBox.Show(name);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
|
|
|
|
|
For BASIC you need to set a REALM (domain) with which to authentication. You also need to specify that BASIC authentication should be used by using the CredentialCache and assigning that to admin.Credentials :
NetworkCredential cred = new NetworkCredential(username, password, domain);
CredentialCache cache = new CredentialCache();
cache.Add(new Uri(url), "Basic", cred);
admin.Credentials = cache;
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I just starting to work on C# last month. Just bear with me if I show my lack of experiences. I am trying to make program that populating the list in propertygrid. I found good article for me like this:http://www.codeproject.com/cs/miscctrl/customizingcollectiondata.asp#xx653437xx . But, I really have problem with standard editor. I cant rid the ... button(I think it called modal) from propertygrid. I tried to use : public override UITypeEditorEditStyle GetStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.None;
}
but somehow it blocked me to show the list. For example, if I am using without codes above, then it will show whole list, but it showed the ... button(modal whatever it is) on the list that I dont want to see. If I am using with codes above, then it wont show the list at all but modal button wont appear at all. what is your suggestions about my situation?
about this articles that I linked, is there another way to make list in propertygrid instead using with CollectionBase, ICustomTypeDescriptor bec I dont like those?
My property grid should look like this:
CategoryAttribute:
+ ITEM1
+ ITEM2
+ ITEM3
+ ITEM4
+ ITEM5
Thanks in advance!!
|
|
|
|
|
Hi,
Software:
.NET 1.1 (both non-SP and SP1)
Visual Studio .NET 2003
MS SQL Server 2000 SP3
Windows XP SP 2
Hardware:
Intel Celeron 1700, Pentium 4 2.4GHz, AMD Athlon 1100
RAM 256-512 DDR
I've run into a strange problem. There is an application which allows to:
1) connect to a certain device using a modem
2) manage different aspects (mostly, working with MS SQL Server)
Serial communication is done on a separate thread, one per each connection.
The maximum number of simultaneous connections is 20.
Note: what is written below applies only when running the application not
under the debugger.
The app starts and works correctly: accepts incoming calls, performs
different scenarios, dials out when necessary. When the comms thread needs to
modify the UI, it is correctly done using Control.BeginInvoke. However,
sometimes (on different computers) the following exception is thrown:
System.OutOfMemory exception: error creating window handle --->
System.NullReferenceException: Object reference not set to an instance of
object.
at System.Windows.Forms.ThreadContext.OnThreadException
at System.Windows.Forms.Control.WndProcException
at System.Windows.Forms.ControlNativeWindow.OnThreadException
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(int32, string,
string, int32, int32, int32, int32, int32, HandleRef, HandleRef, HandleRef,
object)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(int32, string,
string, int32, int32, int32, int32, int32, HandleRef, HandleRef, HandleRef,
object)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams)
-- End of inner exception stack trace --
at System.Windows.Forms.ThreadContext.OnThreadException
at System.Windows.Forms.Control.WndProcException
at System.Windows.Forms.ControlNativeWindow.OnThreadException
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef, int32)
at System.Windows.Forms.Control.SetVisibleCore
at System.Windows.Forms.Form.SetVisibleCore
at System.Windows.Forms.Control.set_Visible
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog
at <my form-my="" code="" to="" showdialog="">
What could be the problem?
Let me stress that this does not happen under debuggers. When debugging, the
exception is not thrown. It was noted that this happens more often when
having an active connection.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
I see from your stacktrace that you're using ShowDialog . When using modal dialogs, you need to make sure you dispose your forms or you will lose memory quickly. This isn't always a problem running under a debugger because the GC hasmore time to clean-up resources.
When displaying modal dialogs using ShowDialog , it's best to use the using block statement as below:
using (MyForm form = new MyForm())
{
form.ShowDialog();
} This compiles to something similar to this:
MyForm form = null;
try
{
form = new MyForm();
form.ShowDialog();
}
finally
{
if (form != null) ((IDisposable)form).Dispose();
} This way - even if an exception is thrown - the form's resources (i.e., the message pump on the new thread and other native resources used by the controls, since the controls merely encapsulate native Common Controls and other windows, are freed-up.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|