Hi
I'm trying to create an array with variable including hyphen
but ksh refuses the first element
set -A allArgs
set +A allArgs ${allArgs} -all
set +A allArgs ${allArgs} -date
set +A allArgs ${allArgs} test
./test.ksh: -all: bad option(s)
It happens only when first element is like... (4 Replies)
set -A matched #find referenced files.
for i in ${file_names_html}
do
counter_j=0
for j in ${file_names_minus_index}
do
match=`cat $i | grep... (1 Reply)
Hi all,
I need help with the following scenario in ksh.
If the number of elements contained by arrayA is 11 I need to insert a zero as the element arrayA then print all arrayA elements separated by comma.
Appreciate your help. (9 Replies)
Hi,
I have:
# Initialize variables
#!/usr/bin/ksh
FILENM=$1
INDEX=0
# read filename
echo "You are working with the Config file: $FILENM"
while read line
do
echo $line
data=$line
((INDEX=INDEX+1))
done <"$FILENM" (3 Replies)
Hi, I have an ksh array(ARR). the elements to the array are file names. i need to go to each file in the array and manipulate the records.
for name in ${files}; do ---this loop is for all the file names in the array
for i in $(wc -l < $name); do --this loop is for all the records in... (20 Replies)
This question is for someone that's more familiar with Array Element.
I need to know if the maximum array element that can be assigned is 1024 and if its so, Is there a workaround solution when the counter exceeded 1024?
param_array="$param_nam"
counter=$counter+1
#to avoid space... (3 Replies)
Hello,
I have a simple task and I am having some trouble with the syntax. I have a variable with an assigned value,
CMD_STRING='-L 22 -s 0 -r -O -A i -N 100 -n'
I would like to add that variable to an array. As far as I have been able to look up, the syntax should be something like,
... (4 Replies)
Hi,
could you help me in processing this file under bash?
I need to add some text to the first line and then append the last element of the second columns.
The input file is tab separated while the output should be space separated.
input file is
1.00E-02 2.00E-02 4.465E+17
2.00E-02 3.00E-02... (4 Replies)
I have an array in an external file, "array.txt", which contains:
char *testarray={"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};I want to be able to add an element to this array, and have that element display, whenever I call it, without having to recompile... (29 Replies)
Discussion started by: ignatius
29 Replies
LEARN ABOUT OPENSOLARIS
mlib_imagenormcrosscorrel
mlib_ImageNormCrossCorrel(3MLIB) mediaLib Library Functions mlib_ImageNormCrossCorrel(3MLIB)NAME
mlib_ImageNormCrossCorrel - normalized cross correlation
SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ]
#include <mlib.h>
mlib_status mlib_ImageNormCrossCorrel(mlib_d64 *correl,
const mlib_image *img1, const mlib_image *img2, const mlib_d64 *mean2,
const mlib_d64 *sdev2);
DESCRIPTION
The mlib_ImageNormCrossCorrel() function computes the normalized cross-correlation coefficients between a pair of images, on a per-channel
basis.
It uses the following equations:
w-1 h-1
SUM SUM (d1[x][y][i] * d2[x][y][i])
x=0 y=0
correl[i] = -------------------------------------
s1[i] * s2[i]
d1[x][y][i] = img1[x][y][i] - m1[i]
d2[x][y][i] = img2[x][y][i] - m2[i]
1 w-1 h-1
m1[i] = ----- * SUM SUM img1[x][y][i]
w*h x=0 y=0
1 w-1 h-1
m2[i] = ----- * SUM SUM img2[x][y][i]
w*h x=0 y=0
w-1 h-1
s1[i] = sqrt{ SUM SUM (img1[x][y][i] - m1[i])**2 }
x=0 y=0
w-1 h-1
s2[i] = sqrt{ SUM SUM (img2[x][y][i] - m2[i])**2 }
x=0 y=0
where w and h are the width and height of the images, respectively; m1 and m2 are the mean arrays of the first and second images, respec-
tively; s1 and s2 are the un-normalized standard deviation arrays of the first and second images, respectively.
In usual cases, the normalized cross-correlation coefficient is in the range of [-1.0, 1.0]. In the case of (s1[i] == 0) or (s2[i] == 0),
where a constant image channel is involved, the normalized cross-correlation coefficient is defined as follows:
#define signof(x) ((x > 0) ? 1 : ((x < 0) ? -1 : 0))
if ((s1[i] == 0.) || (s2[i] == 0.)) {
if ((s1[i] == 0.) && (s2[i] == 0.)) {
if (signof(m1[i]) == signof(m2[i]) {
correl[i] = 1.0;
} else {
correl[i] = -1.0;
}
} else {
correl[i] = -1.0;
}
}
The two images must have the same type, the same size, and the same number of channels. They can have 1, 2, 3 or 4 channels. They can be of
type MLIB_BYTE, MLIB_SHORT, MLIB_USHORT or MLIB_INT.
If (mean2 == NULL) or (sdev2 == NULL), then m2 and s2 are calculated in this function according to the formulas shown above. Otherwise,
they are calculated as follows:
m2[i] = mean2[i];
s2[i] = sdev2[i] * sqrt(w*h);
where mean2 and sdev2 can be the output of mlib_ImageMean() and mlib_ImageStdDev(), respectively.
PARAMETERS
The function takes the following arguments:
correl Pointer to normalized cross correlation array on a channel basis. The array must be the size of channels in the images. correl[i]
contains the cross-correlation of channel i.
img1 Pointer to first image.
img2 Pointer to second image.
mean2 Pointer to the mean array of the second image.
sdev2 Pointer to the standard deviation array of the second image.
RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO mlib_ImageAutoCorrel(3MLIB), mlib_ImageAutoCorrel_Fp(3MLIB), mlib_ImageCrossCorrel(3MLIB), mlib_ImageCrossCorrel_Fp(3MLIB), mlib_ImageNorm-
CrossCorrel_Fp(3MLIB), attributes(5)SunOS 5.11 2 Mar 2007 mlib_ImageNormCrossCorrel(3MLIB)