Posts

interpolation - Interpolating 1 dimensional array using OpenCV -

Image
i define array of 2 values, , try use imgproc module's resize function resize 10 elements linear interpolation interpolation method. cv::mat input = cv::mat(1, 2, cv_32f); input.at<float>(0, 0) = 0.f; input.at<float>(0, 1) = 1.f; cv::mat output = cv::mat(1, 11, cv_32f); cv::resize(input, output, output.size(), 0, 0, cv::inter_linear); for(int i=0; i<11; ++i) { std::cout<< output.at<float>(0, i) << " "; } the output have expected is: 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 what is: 0 0 0 0.136364 0.318182 0.5 0.681818 0.863636 1 1 1 clearly, understanding of how resize works wrong @ fundamental level. can please tell me doing wrong? admittedly, opencv overkill such simple linear interpolation, please me wrong here. it's simple. opencv image processing library. should remember working on images. take @ output when have 8 pixels in destination image 0 0 0.125 0.375 0.625 0.875 1 1 if take @ image it...

excel - Continuing a function -

i'm trying write vba macro analyzes multiple sheets of data in same excel file. have set when it's analyzing various sheets, when finds error, stops program completely. have figured out how go next sheet cannot program continue running. here have far: `if counter > 480 worksheets(activesheet.index + 1).select end end if` i know end function ends running program when take out not work, how can program continue running before reaches sheet error? put loop want end in separate function or sub, when error found, use exit function or exit sub if it's sub. simple example using code: sub main othersub 'continue here end sub sub othersub if counter > 480 worksheets(activesheet.index + 1).select exit sub end if end sub

bash - linux script with netcat stops working after x hours -

i've have scripts: #!/bin/bash netcat -lk -p 12345 | while read line match=$(echo $line | grep -c 'keep-alive') if [ $match -eq 1 ]; [start command] fi done and #!/bin/bash netcat -lk -p 12346 | while read line match=$(echo $line | grep -c 'keep-alive') if [ $match -eq 1 ]; [start command] fi done i've put 2 scripts in '/etc/init.d/' when restart linux machine (rasbpi), both scripts work fine. i've tried them 20 times, , keep working fine. but after around 12 hours, whole system stops working. i've put in loggin, seems scripts not reacting anymore. when i; ps aux i can see scripts still running: root 1686 0.0 0.2 2740 1184 ? s aug12 0:00 /bin/bash /etc/init.d/script1.sh start root 1689 0.0 0.1 2268 512 ? s aug12 0:00 netcat -lk 12345 root 1690 0.0 0.1 2744 784 ? s aug12 0:00 /bin/bash /etc/init.d/script1.sh start r...

opencl optimal group size -

i'm running mandelbrot generator (2d image static params) on opencl. program straightforward: __kernel void mandelbrot(__global uchar * output, const float xstep, const float xoffset, const float ystep, const float yoffset, const int maxiter) { int gid_y = get_global_id(1); int gid_x = get_global_id(0); //calculate x , y on fly every pixel. //this fast reading precalculated rulers global memory. float x = gid_x * xstep + xoffset; float y = gid_y * ystep + yoffset; float real = 0; float imag = 0; int out = 0; for(int curiter = 0; curiter < maxiter; curiter++) { float nreal = real*real - imag*imag + x; imag = 2* real*imag + y; real = nreal; if (real*real + imag*imag > 4.0f) { out = curiter; break; } } //normalize output out *= 256.0 / (float)maxiter; output[gid_y * ge...

Append lines of text above or below the dataframe in r -

i have huge data frame (dimension:600000 x 6). 6 columns integer values representing different features each row. add 3 lines of text either above or below data frame common rows. possible insert lines of text below or above data frame? for example: given dataframe, name<-letters[1:10] length<-c(140,50,25,120,156,146,180,98,120,110) quality<-c(20,25,35,20,15,28,32,35,29,25) df<-data.frame(name,length,quality) how insert 3 lines of text either above or below data frame,df: no. of reads = 10 %at=32 %gc=30 the output should like: name length quality 1 140 20 2 b 50 25 3 c 25 35 4 d 120 20 5 e 156 15 6 f 146 28 7 g 180 32 8 h 98 35 9 120 29 10 j 110 25 no. of reads = 10 %at=32 %gc=30 are looking this? prettyprint <- function() { print(df) cat("no. ...

java - Would inner classes work better for what I'm modelling? -

i'm bulding application in java play 2. modelling different classes of people, each different relationships other classes related application process. each application has signatory , certificateholder , , enrolmentofficer . i realised since 1 person or of things, redundant store information on them 3 times. refactoring in order! i decided have single person class store 1 of each of signatory , certificateholder , , enrolmentofficer classes via object composition. access of properties using person.signatory. notation. what i'm wondering this: since 3 specialised classes not exist outside of person , better achieve goal using inner classes? mean so: public class person { public class signatory { // signatory fields go here } public class certificateholder { // certificateholder fields go here } public class enrolmentofficer { // enrolmentofficer fields go here } // more general person code goes here } it s...

android - Google Maps API v2 displaying maps only on one device -

we using same api key in manifest file, obtained the sha-1 fingerprint displaying map on 1 device(the first device run it) , not on other devices. using fragmentactivity. problem. please guys change max sdk ver 18 (android 4.3). suppose device fail. an other option - if use developers sha-1 (the 1 generate adb) , instaled app on devices difrent computers computer, assume need sha-1 fingerprint other computer.