# Revision history [back]

### Combining FAST and SIFT: low Keypoint size

I try to combine the FAST algorithm and parts of the SIFT Algorithm to get a fast Solution for Mobile Phones. The code I created for that works like the following:

• Get Image
• calculate Size for Resize with src.rows/factor and src.cols/factorwhere factor = sqrt(2)
• resize Image (INTER_NEAREST) and Blur it with GaussianKernel(5x5)
• Run FAST over the new smaller and blurred Image
• Iterate through every candidate and make a Image Patch (15x15) with the candidate in its origin
• calculate the OrientationHistogram and get the peaks of it.

The first Steps are running pretty good. But the last one seems to result in ONLY 4 Keypoints while I get 220193 Candidates from FAST.

The Code I am using is similar with the code from calcOrientationHist from the sift.cpp The Input Image is my Image Patch, the Point is the Candidates Point. To calculate the radius and sigma I needed scl_octvbut because I dont really go in "Octaves" through the Image I just calculated it like this: float scl_octv = kpt.size * 0.5f / (1 << 1);similar to the sift.cpp but with the difference that I add bytewise 1 and not the actual octave. The Peak detection after creating the histogram looks like this:

float mag_thr = (float)(omax * SIFT_ORI_PEAK_RATIO);

for(int j = 0; j < n; j++){
int l = j > 0 ? j - 1 : n -1;
int r2 = j < n-1 ? j+1 : 0;

if(hist[j] > hist[l] && hist[j] > hist[r2] && hist[j] >= mag_thr){
float bin = j + 0.5f * ( hist[i] - hist[r2] ) / ( hist[l] - 2 * hist[j] + hist[r2]);
bin = bin < 0 ? n +bin : bin >= n ? bin - n : bin;
kpt.angle = 360.f - (float)((360.f/n) * bin);
if(std::abs(kpt.angle - 360.f) < FLT_EPSILON)
kpt.angle = 0.f;
features.push_back(kpt);


Where SIFT_ORI_PEAK_RATIO is 0.8f. When I cout the size of features I get the number 4 in the console. The Image I am using for testing is this: After it is read through ìmreadI turn it into a grayscale image withcvtColor(bas, src, CV_BGR2GRAY);wherebasis the loaded Image andsrc the output. In my Example I only go through one Resize and Blur step.

I hope somebody can see why it doesn't work fine.

### Combining FAST and SIFT: low Keypoint size

I try to combine the FAST algorithm and parts of the SIFT Algorithm to get a fast Solution for Mobile Phones. The code I created for that works like the following:

• Get Image
• calculate Size for Resize with src.rows/factor and src.cols/factorwhere factor = sqrt(2)
• resize Image (INTER_NEAREST) and Blur it with GaussianKernel(5x5)
• Run FAST over the new smaller and blurred Image
• Iterate through every candidate and make a Image Patch (15x15) with the candidate in its origin
• calculate the OrientationHistogram and get the peaks of it.

The Idea for this comes from this Paper

The first Steps are running pretty good. But the last one seems to result in ONLY 4 Keypoints while I get 220193 Candidates from FAST.

The Code I am using is similar with the code from calcOrientationHistcalcOrientationHist Function from the sift.cpp The Input Image is my Image Patch, the Point is the Candidates Point. To calculate the radius and sigma I needed scl_octvbut because I dont really go in "Octaves" through the Image I just calculated it like this: float scl_octv = kpt.size * 0.5f / (1 << 1);similar to the sift.cpp but with the difference that I add bytewise 1 and not the actual octave. The Peak detection after creating the histogram looks like this:

float mag_thr = (float)(omax * SIFT_ORI_PEAK_RATIO);

for(int j = 0; j < n; j++){
int l = j > 0 ? j - 1 : n -1;
int r2 = j < n-1 ? j+1 : 0;

if(hist[j] > hist[l] && hist[j] > hist[r2] && hist[j] >= mag_thr){
float bin = j + 0.5f * ( hist[i] - hist[r2] ) / ( hist[l] - 2 * hist[j] + hist[r2]);
bin = bin < 0 ? n +bin : bin >= n ? bin - n : bin;
kpt.angle = 360.f - (float)((360.f/n) * bin);
if(std::abs(kpt.angle - 360.f) < FLT_EPSILON)
kpt.angle = 0.f;
features.push_back(kpt);


Where SIFT_ORI_PEAK_RATIO is 0.8f. When I cout the size of features I get the number 4 in the console. The Image I am using for testing is this: After it is read through ìmreadI turn it into a grayscale image withcvtColor(bas, src, CV_BGR2GRAY);wherebasis the loaded Image andsrc the output. In my Example I only go through one Resize and Blur step.

I hope somebody can see why it doesn't work fine.

### Combining FAST and SIFT: low Keypoint size

I try to combine the FAST algorithm and parts of the SIFT Algorithm to get a fast Solution for Mobile Phones. The code I created for that works like the following:

• Get Image
• calculate Size for Resize with src.rows/factor and src.cols/factorwhere factor = sqrt(2)
• resize Image (INTER_NEAREST) and Blur it with GaussianKernel(5x5)
• Run FAST over the new smaller and blurred Image
• Iterate through every candidate and make a Image Patch (15x15) with the candidate in its origin
• calculate the OrientationHistogram and get the peaks of it.

Here the Code:

    rows = src.rows/factor;
cols = src.cols/factor;

resize(src, tmp, Size(rows, cols),0,0,INTER_NEAREST);
GaussianBlur(tmp, dst, Size(5,5),0,0);

FAST(dst, candidates, 0,true);

if(candidates.size() > 0){

for(int i = 0; i < candidates.size(); i++){
if(candidates[i].pt.x > 7 && candidates[i].pt.y > 7){
KeyPoint kpt = candidates[i];

int px = kpt.pt.x -7;
int py = kpt.pt.y -7;
if(px + 15 >= src.cols || py + 15 >= src.rows)
continue;

patch = src(Rect(px,py,15,15));

float scl_octv = kpt.size * 0.5f / (1 << k);

float omax = calcOrientationHist(patch, kpt.pt, cvRound(SIFT_ORI_RADIUS * scl_octv), SIFT_ORI_SIG_FCTR * scl_octv, hist, n);


and the calcOrientationHist function:

static float calcOrientationHist(const Mat& img, Point pt, int radius, float sigma, float* hist, int n){

float expf_scale = -1.f/(2.f * sigma * sigma);

AutoBuffer<float> buf(len*4+n+4);

float *X = buf, *Y = X + len, *Mag = X, *Ori = Y + len, *W = Ori + len;
float* temphist = W + len + 2;

for( i = 0; i < n; i++){

temphist[i] = 0.f;
}

int y = pt.y+i;
if( y <= 0 || y >= img.rows -1)
continue;

int x = pt.x + j;
if(x <= 0 || x >= img.cols -1)
continue;
//in opencv sift at<sift_wt>
float dx = (float)(img.at<uchar>(y, x+1) - img.at<uchar>(y,x-1));
float dy = (float)(img.at<uchar>(y-1,x) - img.at<uchar>(y+1,x));

X[k] = dx; Y[k] = dy; W[k] = (i*i + j*j)*expf_scale;
k++;
}
}

len = k;

//compute gradient values, orientations and the weights over the pixel neighborhood
hal::exp32f(W, W, len);
hal::fastAtan2(Y, X, Ori, len, true);
hal::magnitude32f(X, Y, Mag, len);

for( k = 0; k < len; k ++){
int bin = cvRound((n/360.f)+Ori[k]);
if(bin >= n)
bin -=n;
if(bin < 0 )
bin +=n;
temphist[bin] += W[k]*Mag[k];
}

//smooth the histogram
temphist[-1] = temphist[n-1];
temphist[-2] = temphist[n-2];
temphist[n] = temphist;
temphist[n+1] = temphist;

for(i = 0; i < n; i++){

hist[i] = (temphist[i-2] + temphist[i+2])*(1.f/16.f)+
(temphist[i-1] +temphist[i+1])*(4.f/16.f)+
temphist[i]*(6.f/16.f);
}

float maxval = hist;
for(i = 1; i < n; i++)
maxval = std::max(maxval, hist[i]);

return maxval;
}


The Idea for this comes from this Paper

The first Steps are running pretty good. But the last one seems to result in ONLY 4 Keypoints while I get 220193 Candidates from FAST.

The Code I am using is similar with the code from calcOrientationHist Function from the sift.cpp The Input Image is my Image Patch, the Point is the Candidates Point. To calculate the radius and sigma I needed scl_octvbut because I dont really go in "Octaves" through the Image I just calculated it like this: float scl_octv = kpt.size * 0.5f / (1 << 1);similar to the sift.cpp but with the difference that I add bytewise 1 and not the actual octave. The Peak detection after creating the histogram looks like this:

float mag_thr = (float)(omax * SIFT_ORI_PEAK_RATIO);

for(int j = 0; j < n; j++){
int l = j > 0 ? j - 1 : n -1;
int r2 = j < n-1 ? j+1 : 0;

if(hist[j] > hist[l] && hist[j] > hist[r2] && hist[j] >= mag_thr){
float bin = j + 0.5f * ( hist[i] - hist[r2] ) / ( hist[l] - 2 * hist[j] + hist[r2]);
bin = bin < 0 ? n +bin : bin >= n ? bin - n : bin;
kpt.angle = 360.f - (float)((360.f/n) * bin);
if(std::abs(kpt.angle - 360.f) < FLT_EPSILON)
kpt.angle = 0.f;
features.push_back(kpt);


Where SIFT_ORI_PEAK_RATIO is 0.8f. When I cout the size of features I get the number 4 in the console. The Image I am using for testing is this: After it is read through ìmread I turn it into a grayscale image withwith cvtColor(bas, src, CV_BGR2GRAY);
where wherebasbas is the loaded Image andand srcsrc the output. In my Example I only go through one Resize and Blur step.

 I hope somebody can see why it doesn't work fine. 4 No.4 Revision updated 2016-09-29 03:38:22 -0500 Combining FAST and SIFT: low Keypoint size I try to combine the FAST algorithm and parts of the SIFT Algorithm to get a fast Solution for Mobile Phones. The code I created for that works like the following: Get Image calculate Size for Resize with src.rows/factor and src.cols/factorwhere factor = sqrt(2) resize Image (INTER_NEAREST) and Blur it with GaussianKernel(5x5) Run FAST over the new smaller and blurred Image Iterate through every candidate and make a Image Patch (15x15) with the candidate in its origin calculate the OrientationHistogram and get the peaks of it. Here the Code: rows = src.rows/factor; cols = src.cols/factor; resize(src, tmp, Size(rows, cols),0,0,INTER_NEAREST); GaussianBlur(tmp, dst, Size(5,5),0,0); FAST(dst, candidates, 0,true); if(candidates.size() > 0){ for(int i = 0; i < candidates.size(); i++){ if(candidates[i].pt.x > 7 && candidates[i].pt.y > 7){ KeyPoint kpt = candidates[i]; int px = kpt.pt.x -7; int py = kpt.pt.y -7; if(px + 15 >= src.cols || py + 15 >= src.rows) continue; patch = src(Rect(px,py,15,15)); float scl_octv = kpt.size * 0.5f / (1 << k); float omax = calcOrientationHist(patch, kpt.pt, cvRound(SIFT_ORI_RADIUS * scl_octv), SIFT_ORI_SIG_FCTR * scl_octv, hist, n); and the calcOrientationHist function: static float calcOrientationHist(const Mat& img, Point pt, int radius, float sigma, float* hist, int n){ int i, j, k, len = (radius*2+1)*(radius*2+1); float expf_scale = -1.f/(2.f * sigma * sigma); AutoBuffer<float> buf(len*4+n+4); float *X = buf, *Y = X + len, *Mag = X, *Ori = Y + len, *W = Ori + len; float* temphist = W + len + 2; for( i = 0; i < n; i++){ temphist[i] = 0.f; } for(i = -radius, k = 0; i <= radius; i++){ int y = pt.y+i; if( y <= 0 || y >= img.rows -1) continue; for(j = - radius; j <= radius; j++){ int x = pt.x + j; if(x <= 0 || x >= img.cols -1) continue; //in opencv sift at<sift_wt> float dx = (float)(img.at<uchar>(y, x+1) - img.at<uchar>(y,x-1)); float dy = (float)(img.at<uchar>(y-1,x) - img.at<uchar>(y+1,x)); X[k] = dx; Y[k] = dy; W[k] = (i*i + j*j)*expf_scale; k++; } } len = k; //compute gradient values, orientations and the weights over the pixel neighborhood hal::exp32f(W, W, len); hal::fastAtan2(Y, X, Ori, len, true); hal::magnitude32f(X, Y, Mag, len); for( k = 0; k < len; k ++){ int bin = cvRound((n/360.f)+Ori[k]); if(bin >= n) bin -=n; if(bin < 0 ) bin +=n; temphist[bin] += W[k]*Mag[k]; } //smooth the histogram temphist[-1] = temphist[n-1]; temphist[-2] = temphist[n-2]; temphist[n] = temphist; temphist[n+1] = temphist; for(i = 0; i < n; i++){ hist[i] = (temphist[i-2] + temphist[i+2])*(1.f/16.f)+ (temphist[i-1] +temphist[i+1])*(4.f/16.f)+ temphist[i]*(6.f/16.f); } float maxval = hist; for(i = 1; i < n; i++) maxval = std::max(maxval, hist[i]); return maxval; } Code: Migrated to Github because it is really long The Idea for this comes from this Paper The first Steps are running pretty good. But the last one seems to result in ONLY 4 Keypoints while I get 220193 Candidates from FAST. EDIT I found such a low Keypoint size, because I was inserting the Point Location of the Interest Point in the Source Image not the Image Patch which I pass to the calcOrientationHist Function But now I got another Error look at EDIT2 The Code I am using is similar with the code from calcOrientationHist Function from the sift.cpp The Input Image is my Image Patch, the Point is the Candidates Point. To calculate the radius and sigma I needed scl_octvbut because I dont really go in "Octaves" through the Image I just calculated it like this: float scl_octv = kpt.size * 0.5f / (1 << 1);similar to the sift.cpp but with the difference that I add bytewise 1 and not the actual octave. The Peak detection after creating the histogram looks like this: float mag_thr = (float)(omax * SIFT_ORI_PEAK_RATIO); for(int j = 0; j < n; j++){ int l = j > 0 ? j - 1 : n -1; int r2 = j < n-1 ? j+1 : 0; if(hist[j] > hist[l] && hist[j] > hist[r2] && hist[j] >= mag_thr){ float bin = j + 0.5f * ( hist[i] - hist[r2] ) / ( hist[l] - 2 * hist[j] + hist[r2]); bin = bin < 0 ? n +bin : bin >= n ? bin - n : bin; kpt.angle = 360.f - (float)((360.f/n) * bin); if(std::abs(kpt.angle - 360.f) < FLT_EPSILON) kpt.angle = 0.f; features.push_back(kpt); Where SIFT_ORI_PEAK_RATIO is 0.8f. When I cout the size of features I get the number 4 in the console. The Image I am using for testing is this: console. After it the Image is read through ìmread I turn it into a grayscale image with cvtColor(bas, src, CV_BGR2GRAY); where bas is the loaded Image and src the output. In my Example I only go through one Resize and Blur step. EDIT2 After solving this Error, I get a Malloc Error now. The Position this Error is thrown is at Line 207 in my Code I already tried to free as much Memory as possible, but I don't believe, that this is the Solution. XCode Analysis says, that my Application needs 9MB memory. I hope somebody can see why it doesn't work fine.the Error Occurs. 5 No.5 Revision updated 2016-09-29 03:41:24 -0500 Combining FAST and SIFT: low Keypoint size I try to combine the FAST algorithm and parts of the SIFT Algorithm to get a fast Solution for Mobile Phones. The code I created for that works like the following: Get Image calculate Size for Resize with src.rows/factor and src.cols/factorwhere factor = sqrt(2) resize Image (INTER_NEAREST) and Blur it with GaussianKernel(5x5) Run FAST over the new smaller and blurred Image Iterate through every candidate and make a Image Patch (15x15) with the candidate in its origin calculate the OrientationHistogram and get the peaks of it. Here the Code: Migrated to Github because it is really long The Idea for this comes from this Paper The first Steps are running pretty good. But the last one seems to result in ONLY 4 Keypoints while I get 220193 Candidates from FAST. EDIT I found such a low Keypoint size, because I was inserting the Point Location of the Interest Point in the Source Image not the Image Patch which I pass to the calcOrientationHist Function But now I got another Error look at EDIT2 The Code I am using is similar with the code from calcOrientationHist Function from the sift.cpp The Input Image is my Image Patch, the Point is the Candidates Point. To calculate the radius and sigma I needed scl_octvbut because I dont really go in "Octaves" through the Image I just calculated it like this: float scl_octv = kpt.size * 0.5f / (1 << 1);similar to the sift.cpp but with the difference that I add bytewise 1 and not the actual octave. The Peak detection after creating the histogram looks like this: Where SIFT_ORI_PEAK_RATIO is 0.8f. When I cout the size of features I get the number 4 in the console. After the Image is read through ìmread I turn it into a grayscale image with cvtColor(bas, src, CV_BGR2GRAY); where bas is the loaded Image and src the output. In my Example I only go through one Resize and Blur step. EDIT2 After solving this Error, I get a Malloc Error now. The Position this Error is thrown is at Line 207 in my Code I already tried to free as much Memory as possible, but I don't believe, that this is the Solution. XCode Analysis says, that my Application needs 9MB memory. Also I thought, that I occurs, because I call the Pixel value with img.at<sift_wt>(...) where typedef float sift_wt but the Image Patch is from the type CV_8UC1 (console output 0 at patch.type()) But actually I just took that from the calcOrientationHist from the opencv-contrib. Is Sift calculating the Descriptor in the Source Image? It also should be a Grayscale Image or not? I hope somebody can see the Error Occurs. 6 No.6 Revision updated 2016-09-29 05:51:10 -0500 Combining FAST and SIFT: low Keypoint size I try to combine the FAST algorithm and parts of the SIFT Algorithm to get a fast Solution for Mobile Phones. The code I created for that works like the following: Get Image calculate Size for Resize with src.rows/factor and src.cols/factorwhere factor = sqrt(2) resize Image (INTER_NEAREST) and Blur it with GaussianKernel(5x5) Run FAST over the new smaller and blurred Image Iterate through every candidate and make a Image Patch (15x15) with the candidate in its origin calculate the OrientationHistogram and get the peaks of it. Here the Code: Migrated to Github because it is really long The Idea for this comes from this Paper The first Steps are running pretty good. But the last one seems to result in ONLY 4 Keypoints while I get 220193 Candidates from FAST. EDIT I found such a low Keypoint size, because I was inserting the Point Location of the Interest Point in the Source Image not the Image Patch which I pass to the calcOrientationHist Function But now I got another Error look at EDIT2 The Code I am using is similar with the code from calcOrientationHist Function from the sift.cpp The Input Image is my Image Patch, the Point is the Candidates Point. To calculate the radius and sigma I needed scl_octvbut because I dont really go in "Octaves" through the Image I just calculated it like this: float scl_octv = kpt.size * 0.5f / (1 << 1);similar to the sift.cpp but with the difference that I add bytewise 1 and not the actual octave. The Peak detection after creating the histogram looks like this: Where SIFT_ORI_PEAK_RATIO is 0.8f. When I cout the size of features I get the number 4 in the console. After the Image is read through ìmread I turn it into a grayscale image with cvtColor(bas, src, CV_BGR2GRAY); where bas is the loaded Image and src the output. In my Example I only go through one Resize and Blur step. EDIT2 After solving this Error, I get a Malloc Error now. The Position this Error is thrown is at Line 207 in my Code I already tried to free as much Memory as possible, but I don't believe, that this is the Solution. XCode Analysis says, that my Application needs 9MB memory. Also I thought, that I occurs, because I call the Pixel value with img.at<sift_wt>(...) where typedef float sift_wt but the Image Patch is from the type CV_8UC1 (console output 0 at patch.type()) But actually I just took that from the calcOrientationHist from the opencv-contrib. Is Sift calculating the Descriptor in the Source Image? It also should be a Grayscale Image or not? I hope somebody can see the Error Occurs. EDIT3 After changing the type in the img.at<sift_wt>(...)Position nothing changed. So I googled Solutions and landed at the GuardMalloc feature from XCode. Enabling it showed me a new Error which is probably the Reason I get the Malloc Error. In line 77 of my Code. The Error it gives me at this line is EXC_BAD_ACCESS (Code=1, address=....) There are the following lines: for( k = 0; k < len; k ++){ int bin = cvRound((n/360.f)+Ori[k]); if(bin >= n) bin -=n; if(bin < 0 ) bin +=n; temphist[bin] += W[k]*Mag[k]; } The Values of the mentioned Variables are the following: bin = 52, len = 169, n = 36, k = 0, W, Mag, Ori and temphist are not shown. 7 No.7 Revision updated 2016-09-29 06:43:21 -0500 Combining FAST and SIFT: low Keypoint size I try to combine the FAST algorithm and parts of the SIFT Algorithm to get a fast Solution for Mobile Phones. The code I created for that works like the following: Get Image calculate Size for Resize with src.rows/factor and src.cols/factorwhere factor = sqrt(2) resize Image (INTER_NEAREST) and Blur it with GaussianKernel(5x5) Run FAST over the new smaller and blurred Image Iterate through every candidate and make a Image Patch (15x15) with the candidate in its origin calculate the OrientationHistogram and get the peaks of it. Here the Code: Migrated to Github because it is really long The Idea for this comes from this Paper The first Steps are running pretty good. But the last one seems to result in ONLY 4 Keypoints while I get 220193 Candidates from FAST. EDIT I found such a low Keypoint size, because I was inserting the Point Location of the Interest Point in the Source Image not the Image Patch which I pass to the calcOrientationHist Function But now I got another Error look at EDIT2 The Code I am using is similar with the code from calcOrientationHist Function from the sift.cpp The Input Image is my Image Patch, the Point is the Candidates Point. To calculate the radius and sigma I needed scl_octvbut because I dont really go in "Octaves" through the Image I just calculated it like this: float scl_octv = kpt.size * 0.5f / (1 << 1);similar to the sift.cpp but with the difference that I add bytewise 1 and not the actual octave. The Peak detection after creating the histogram looks like this: Where SIFT_ORI_PEAK_RATIO is 0.8f. When I cout the size of features I get the number 4 in the console. After the Image is read through ìmread I turn it into a grayscale image with cvtColor(bas, src, CV_BGR2GRAY); where bas is the loaded Image and src the output. In my Example I only go through one Resize and Blur step. EDIT2 After solving this Error, I get a Malloc Error now. The Position this Error is thrown is at Line 207 in my Code I already tried to free as much Memory as possible, but I don't believe, that this is the Solution. XCode Analysis says, that my Application needs 9MB memory. Also I thought, that I occurs, because I call the Pixel value with img.at<sift_wt>(...) where typedef float sift_wt but the Image Patch is from the type CV_8UC1 (console output 0 at patch.type()) But actually I just took that from the calcOrientationHist from the opencv-contrib. Is Sift calculating the Descriptor in the Source Image? It also should be a Grayscale Image or not? I hope somebody can see the Error Occurs. EDIT3 After changing the type in the img.at<sift_wt>(...)Position nothing changed. So I googled Solutions and landed at the GuardMalloc feature from XCode. Enabling it showed me a new Error which is probably the Reason I get the Malloc Error. In line 77 of my Code. The Error it gives me at this line is EXC_BAD_ACCESS (Code=1, address=....) There are the following lines: for( k = 0; k < len; k ++){ int bin = cvRound((n/360.f)+Ori[k]); if(bin >= n) bin -=n; if(bin < 0 ) bin +=n; temphist[bin] += W[k]*Mag[k]; } The Values of the mentioned Variables are the following: bin = 52, len = 169, n = 36, k = 0, W, Mag, Ori and temphist are not shown. Here the Guard Malloc Output: GuardMalloc[Test-1935]: Allocations will be placed on 16 byte boundaries. GuardMalloc[Test-1935]: - Some buffer overruns may not be noticed. GuardMalloc[Test-1935]: - Applications using vector instructions (e.g., SSE) should work. GuardMalloc[Test-1935]: version 108 Test(1935,0x102524000) malloc: protecting edges Test(1935,0x102524000) malloc: enabling scribbling to detect mods to free blocks 
 
 
 Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license. about | faq | help | privacy policy | terms of service Powered by Askbot version 0.10.2 Please note: OpenCV answers requires javascript to work properly, please enable javascript in your browser, here is how //IE fix to hide the red margin var noscript = document.getElementsByTagName('noscript'); noscript.style.padding = '0px'; noscript.style.backgroundColor = 'transparent'; askbot['urls']['mark_read_message'] = '/s/messages/markread/'; askbot['urls']['get_tags_by_wildcard'] = '/s/get-tags-by-wildcard/'; askbot['urls']['get_tag_list'] = '/s/get-tag-list/'; askbot['urls']['follow_user'] = '/followit/follow/user/{{userId}}/'; askbot['urls']['unfollow_user'] = '/followit/unfollow/user/{{userId}}/'; askbot['urls']['user_signin'] = '/account/signin/'; askbot['urls']['getEditor'] = '/s/get-editor/'; askbot['urls']['apiGetQuestions'] = '/s/api/get_questions/'; askbot['urls']['ask'] = '/questions/ask/'; askbot['urls']['questions'] = '/questions/'; askbot['settings']['groupsEnabled'] = false; askbot['settings']['static_url'] = '/m/'; askbot['settings']['minSearchWordLength'] = 4; askbot['settings']['mathjaxEnabled'] = false; askbot['settings']['sharingSuffixText'] = ''; askbot['settings']['errorPlacement'] = 'after-label'; askbot['data']['maxCommentLength'] = 800; askbot['settings']['editorType'] = 'markdown'; askbot['settings']['commentsEditorType'] = 'rich\u002Dtext'; askbot['messages']['askYourQuestion'] = 'Ask Your Question'; askbot['messages']['questionSingular'] = 'question'; askbot['messages']['answerSingular'] = 'answer'; askbot['messages']['acceptOwnAnswer'] = 'accept or unaccept your own answer'; askbot['messages']['followQuestions'] = 'follow questions'; askbot['settings']['allowedUploadFileTypes'] = [ "jpg", "jpeg", "gif", "bmp", "png", "tiff" ]; askbot['data']['haveFlashNotifications'] = true; askbot['data']['activeTab'] = 'questions'; askbot['settings']['csrfCookieName'] = 'csrftoken'; askbot['data']['searchUrl'] = ''; /*<![CDATA[*/ $('.mceStatusbar').remove();//a hack to remove the tinyMCE status bar$(document).ready(function(){ // focus input on the search bar endcomment var activeTab = askbot['data']['activeTab']; if (inArray(activeTab, ['users', 'questions', 'tags', 'badges'])) { var searchInput = $('#keywords'); } else if (activeTab === 'ask') { var searchInput =$('#id_title'); } else { var searchInput = undefined; animateHashes(); } if (searchInput) { searchInput.focus(); putCursorAtEnd(searchInput); } var haveFullTextSearchTab = inArray(activeTab, ['questions', 'badges', 'ask']); var haveUserProfilePage = $('body').hasClass('user-profile-page'); if ((haveUserProfilePage || haveFullTextSearchTab) && searchInput && searchInput.length) { var search = new FullTextSearch(); askbot['controllers'] = askbot['controllers'] || {}; askbot['controllers']['fullTextSearch'] = search; search.setSearchUrl(askbot['data']['searchUrl']); if (activeTab === 'ask') { search.setAskButtonEnabled(false); } search.decorate(searchInput); } else if (activeTab === 'tags') { var search = new TagSearch(); search.decorate(searchInput); } if (askbot['data']['userIsAdminOrMod']) {$('body').addClass('admin'); } if (askbot['settings']['groupsEnabled']) { askbot['urls']['add_group'] = "/s/add-group/"; var group_dropdown = new GroupDropdown(); $('.groups-dropdown').append(group_dropdown.getElement()); } var userRep =$('#userToolsNav .reputation'); if (userRep.length) { var showPermsTrigger = new ShowPermsTrigger(); showPermsTrigger.decorate(userRep); } }); if (askbot['data']['haveFlashNotifications']) { $('#validate_email_alert').click(function(){notify.close(true)}) notify.show(); } var langNav =$('.lang-nav'); if (langNav.length) { var nav = new LangNav(); nav.decorate(langNav); } /*]]>*/ //todo - take this out into .js file $(document).ready(function(){$('div.revision div[id^=rev-header-]').bind('click', function(){ var revId = this.id.substr(11); toggleRev(revId); }); lanai.highlightSyntax(); }); function toggleRev(id) { var arrow = $("#rev-arrow-" + id); var visible = arrow.attr("src").indexOf("hide") > -1; if (visible) { var image_path = '/m/default/media/images/expander-arrow-show.gif?v=6'; } else { var image_path = '/m/default/media/images/expander-arrow-hide.gif?v=6'; } image_path = image_path + "?v=6"; arrow.attr("src", image_path);$("#rev-body-" + id).slideToggle("fast"); } for (url_name in askbot['urls']){ askbot['urls'][url_name] = cleanUrl(askbot['urls'][url_name]); } `