|
Hi Queezy,
I can't speak for FFTs and SVD (what are you doing with decomposition, BTW? I recently read a paper which used SVDs as a text indexing algorithm such as Google), but I personally love Crypto++ for anything Cryptography related. This includes its Large Integer package, and Elliptical Curve implementation.
Jeff
|
|
|
|
|
Does anyone know of any good algorithms for calculating a total shipment cube size based on the sizes and quantities of the products in that shipment?
|
|
|
|
|
You may have to look at figuring the volume of each individual product, how many to ship at a time, and then figure out the cube size based on the total volume of the products being shipped...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi All,
I need to find the value after decimal in mathematical way...
Ex: I have a number 19.56 and my formula gives me .56
Please help me...
Thanks in advance...
|
|
|
|
|
What language are you programming in?
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Thanks for the help.I need a mathematical way I dont want to use programming language for this....
|
|
|
|
|
By convention there is the [] operator, defined the following way
[x] = the integer part of x
hence you can use
x-[x]
to extract the decimal part of x
But, I know, it's just another way to say: 'take the decimal part of x ' (BTW it is also a perfectly accetable function definition).
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.
|
|
|
|
|
ExpertComing wrote: The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
LOL...
|
|
|
|
|
in mathematical way I would say
.56 = 19.56 - floor(19.56)
or in c++
float rest = 19.56 - int(19.56);
sufficient?
|
|
|
|
|
|
|
I think it is important for you to clarify what to do with negative numbers. What would you want to obtain with -19.56? -.56 or .44 (=-19.56-20.00)? The formula is usually simple for positive numbers because we all agree the integer part is the largest integer not greater than the given number, but for negative numbers we have to decide which reference to have (either 0 or -oo).
Rilhas
|
|
|
|
|
|
Hi.
I have a multidimensional integer array that represents the colors of a image:
<br />
0 0 1 0 0 0<br />
0 0 1 0 0 0<br />
0 1 0 1 0 0<br />
0 1 0 1 0 0<br />
0 0 1 0 0 0<br />
0 0 1 0 0 0<br />
(in this case, white = 0 & black = 1)
This color map can vary in size, but I don't think that tributes to the solution here.
What I need is a edge detection that detects only the side of the black image;
<br />
0 2 1 2 0 0<br />
0 2 1 2 0 0<br />
2 1 0 1 2 0<br />
2 1 0 1 2 0<br />
0 2 1 2 0 0<br />
0 2 1 2 0 0<br />
2 = detected edge, 1 = black, 0 = white.
I was trying to traverse the hole color map, row by row, pixel by pixel on each side of the rectangle, and when a black color was found, the loop would break and save the position it was at, like this:
textureData[,] - Contains the color map.<br />
<br />
for (int x = 0; x < texture.Width; x++)<br />
{<br />
for (int y = 0; y < texture.Height; y++)<br />
{<br />
if (textureData[x, y] != 0)<br />
{<br />
edgePoints.Add(new Point(x , y));<br />
break;<br />
}<br />
}<br />
}
This works for finding one side, but i can't seem to make a loop for other sides. Please help me.
|
|
|
|
|
Hi,
you should not break out of the for loop; instead you should record every
transition: whenever 0 is followed by 1 you have a positive edge, whenever
1 is followed by 0 you have a negative edge.
So the sequence 0 0 1 1 1 1 0 1 1 0 0 0 has two positive and two negative edges.
You can apply this in any direction you want, typically you only need two
directions (left->right and top->bottom).
Of course a negative edge in left->right direction would be the same as
a positive edge in right->left direction.
Hope this helps
|
|
|
|
|
Yeah, that would make the detection more simple. Thanks.
|
|
|
|
|
hey folks,
I've got quite a complex question for you...
suppose I've got two triangles in different pictures. I can easily compute the homography between those.
Is there a way to compute a Homography for each so that the distortion for each triangle is minimized???
I guess the aspect ratio (or diagonals in a square using this homography) can be used for measuring the amount of distortion.
but how to compute those "points in the middle" where distortion is least??
Say, given are:
x_1,x_2,x_3 (for one triangle)
x_4,x_5,x_6 (for the other one)
We want to know:
x_7,x_8,x_9 ( our destination triangle )
We also know:
H*x_i = x_j (where i = 1,2,3 and j=7,8,9)
H = Homography (/Affine transformation)
and
G*x_i = x_j (where i = 4,5,6 and j=7,8,9)
G = Homography (/Affine transformation)
H =
a b t_x
c d t_y
0 0 1
a/d should be minimal... for H and G
Is it true that b=-c because of rotation which gives no distortion??
any hints and links are appreciated
|
|
|
|
|
Hi -
I'm interested in a pet project to create a player which
will play mp3s (or wavs) backwards. I've never done any
mp3 encoding/decoding before, but it seems like it should
be easy to do with the following algorithm:
1 - load wav file
2- extract bytes which correspond to pcm sound data
3 - create a new file with the byte order reversed
4 - play with any old sound dll.
does this seem right? any suggestions on where to find a
specification of a standard wav file? am i correct in assuming
that pcm sound information can be directly reversed?
thanks - @lrg
|
|
|
|
|
Hi,
I think you got the idea right, however it is important to clarify that WAV files may be compressed (ADPCM, A-LAW, u-LAW, etc.). This means that you can find many WAV files whose bytes do not correspond to plain PCM samples.
In general I would say that you should modify your algorithm so that you load a file (WAV or MP3) and then normalize it to linear PCM samples. For ADPCM or x-LAW this may correspond to simple sample-based decompression schemes, for MP3 you should probably get a decoder (there are open source MP3 libraries out there). But please note that MP3 is a licensed technology (even if you get the algorithm or source code legally you still have to pay to use it).
After this normalization stage you simply reverse the samples and write them back to disk (or play them directly from RAM, why not??). The x-LAW files could be played directly simply by reversing the samples (even without decompressing) and saving to file or playing directly (requesting an x-LAW audio output format).
If you want to write to disk then uncompressed WAV is the easiest (just a few header bytes and you're done). If you want to write back MP3 it can be a little trickier (and subject to the same royalty restrictions as the decoder).
Anyway, these comments are for simple C/C++ implementations. The COM interface, C#, JAVA, and other languages and platforms may make the task easier (or not!).
About the WAV format: just search for "wav format specification" and you will find many references. For example, http://ccrma.stanford.edu/courses/422/projects/WaveFormat/[^] seems to be ok.
I hope this helps,
Rilhas
|
|
|
|
|
Thanks Rilhas,
That's just the sort of encouragement I needed. I had concluded the same thing - best to do the actual reversal on the simplest wav file. If I support compressed formats at all, I'll just convert them to basic PCM first using any old library.
Awesome dude!
-@LG
|
|
|
|
|
@largeinsd wrote: 3 - create a new file with the byte order reversed
For PCM wave files, this will only work for 8 bit (and below) waveforms. For anything above, you want to reverse the samples not the byte order. For example, a 16 bit PCM waveform monophonic waveform takes two bytes per sample. You don't want to reverse the byte order within the sample but rather reverse the sample order themselves.
So for example say we have the following values for a 16-bit monophonic waveform:
Sample 1
128 - byte 1
64 - byte 2
Sample 2
78 - byte 1
241 - byte 2
To reverse these samples so that they play backwards, we reverse the sample order while leaving the byte order within the samples alone:
Sample 2
78 - byte 1
241 - byte 2
Sample 1
128 - byte 1
64 - byte 2
Make sense?
|
|
|
|
|
leslie,
makes perfect sense. swap the sample order, but preserve the byte order within.
though i don't understand what you're saying with "128 - byte 1" or "78 - byte 1". what are you getting at with the 128, 64, 78, 241.
thanks - @lg
|
|
|
|
|
@largeinsd wrote: though i don't understand what you're saying with "128 - byte 1" or "78 - byte 1". what are you getting at with the 128, 64, 78, 241.
Those were just random numbers I picked for the byte values within the samples.
|
|
|
|
|
ok, cool.
one other question: how is the data encoded for stereo?
thanks - @lg
|
|
|
|
|
@largeinsd wrote: one other question: how is the data encoded for stereo?
Stereo samples are interleaved. What that means is that the samples alternate between the left and right channels. So you have the bytes that make up an individual sample and the block which is made up of two samples, left and right:
( block 1 ) ( block 2 )
left, right, left, right, etc...
|
|
|
|