²é¿´: 1358  |  »Ø¸´: 8

xmcrobbie

Òø³æ (СÓÐÃûÆø)

[ÇóÖú] ÓжγÌÐò£¬¾Í5£¬6ÐУ¬ÎÒ¿´ÁËNÌìÁË£¬Çë½Ì¸ßÊÖ

function Y = sampleWithR(weights,K)
%Y = sampleWithR(weights,K)
%Generates K samples from the discrete distribution specified by weights
%O(K)

%Need to handle border effects
cdf = cumsum(weights);
Y = histc(rand(K,1)*cdf(end),[0; cdf]);
Y = [Y(1:end-2); Y(end-1)+Y(end)];


ÎÒ²»ÖªµÀÕâ¸öº¯ÊýÆðʲô×÷Óð¡¡£¡£¡£¡£
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

haier20022

гæ (ÕýʽдÊÖ)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
ÊÇmatlab³ÌÐò°É£¿
2Â¥2013-10-20 13:33:29
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

feixiaolin

ÈÙÓþ°æÖ÷ (ÎÄ̳¾«Ó¢)

ÓÅÐã°æÖ÷

function Y = sampleWithR(weights,K)
% ÒÀÈ¨ÖµÖØ²ÉÑù£»
cdf = cumsum(weights);
% ȨֵÀÛ¼Ó
Y = histc(rand(K,1)*cdf(end),[0; cdf]);
% ͳ¼ÆÖ±·½Í¼
Y = [Y(1:end-2); Y(end-1)+Y(end)];
% Ö±·½Í¼×îĩһbinÐÞÕý
3Â¥2013-10-20 14:40:26
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

xmcrobbie

Òø³æ (СÓÐÃûÆø)

ÒýÓûØÌû:
3Â¥: Originally posted by feixiaolin at 2013-10-20 14:40:26
function Y = sampleWithR(weights,K)
% ÒÀÈ¨ÖµÖØ²ÉÑù£»
cdf = cumsum(weights);
% ȨֵÀÛ¼Ó
Y = histc(rand(K,1)*cdf(end),);
% ͳ¼ÆÖ±·½Í¼
Y = ;
% Ö±·½Í¼×îĩһbinÐÞÕý...

Y = histc(rand(K,1)*cdf(end),[0; cdf]);  ÕâÐв»Àí½â°¡¡£rand£¨K£¬1£©ÊÇËæ»ú²úÉúK¸ö0µ½1µÄÊý°É¡£[0; cdf] Ó¦¸ÃÊÇÔÚÔÚcdf2ǰ¼Ó¸ö0°É¡£

Ó¦¸ÃÊÇ¿´¿´²úÉúµÄÕâK¸öÊý£¬ÂäÔÚͳ¼ÆÖ±·½Í¼Öи÷¸öbinµÄ¸öÊý°É¡£¡£¡£

ÕâôÀí½â¶ÔÂð£¿
4Â¥2013-10-20 16:30:32
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

coolslj

½ð³æ (ÕýʽдÊÖ)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï ¡ï ¡ï ¡ï ¡ï
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
xmcrobbie: ½ð±Ò+2 2013-11-04 15:32:52
xmcrobbie: ½ð±Ò+3 2013-11-04 15:33:37
Generates K samples from the discrete distribution specified by weights
¸ù¾ÝÀëÉ¢·Ö²¼½øÐвÉÑù£¬¸Ã·Ö²¼ÓÃÑù±¾È¨Öرíʾ

rand(K,1)*cdf(end)µÄÄ¿µÄÊÇ£º½«²úÉúµÄ0-1Ö®¼äµÄËæ»úÊý£¬·ÅËõµ½ÉÏÊöÀëÉ¢·Ö²¼£¨ÒòÎªÈ¨ÖØweightsµÄ×ܺͿÉÄܲ»µÈÓÚ1£©¡£²»·Á¼ÙÉèrand(K,1)·µ»Ø1£¬¾ÍÈÝÒ×Àí½âËüµÄº¬ÒåÁË¡£

[0; cdf] µÄº¬ÒåÓëcumsumµÄ¾ßÌåʵÏÖÓйء£
5Â¥2013-10-21 08:20:40
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

xmcrobbie

Òø³æ (СÓÐÃûÆø)

ÒýÓûØÌû:
5Â¥: Originally posted by coolslj at 2013-10-21 08:20:40
Generates K samples from the discrete distribution specified by weights
¸ù¾ÝÀëÉ¢·Ö²¼½øÐвÉÑù£¬¸Ã·Ö²¼ÓÃÑù±¾È¨Öرíʾ

rand(K,1)*cdf(end)µÄÄ¿µÄÊÇ£º½«²úÉúµÄ0-1Ö®¼äµÄËæ»úÊý£¬·ÅËõµ½ÉÏÊöÀëÉ¢·Ö²¼£¨ÒòÎªÈ¨ÖØ ...

ʵ¼ÊÉÏY¾ØÕóÊÇËæ»úÊýÔÚweighsÖ±·½Í¼µÄ·Ö²¼£¬YµÄÖµweighsµÄÖµ²¢Ã»ÓÐÖ±½Ó¹ØÏµ£¬²»ÖªµÀÕâÑù×Ó²ÉÑùÓÐʲôÒâÒå¡£
6Â¥2013-10-21 15:10:19
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

coolslj

½ð³æ (ÕýʽдÊÖ)

ÒýÓûØÌû:
6Â¥: Originally posted by xmcrobbie at 2013-10-21 15:10:19
ʵ¼ÊÉÏY¾ØÕóÊÇËæ»úÊýÔÚweighsÖ±·½Í¼µÄ·Ö²¼£¬YµÄÖµweighsµÄÖµ²¢Ã»ÓÐÖ±½Ó¹ØÏµ£¬²»ÖªµÀÕâÑù×Ó²ÉÑùÓÐʲôÒâÒå¡£...

Â¥Ö÷ûÓÐÌṩ¸Ã³ÌÐòµÄ±³¾°ºÍÉÏÏÂÎÄ£¬ËùÒÔר¼ÒÃÇÓеãäÈËÃþÏó¡£

¸Ã³ÌÐò¸ù¾ÝÒ»¸ö·Ö²¼µÄÖ±·½Í¼£¬²úÉúÁËÒ»¸öеķֲ¼µÄÖ±·½Í¼¡£
´ÓÕâ¸ö½Ç¶È¿´£¬¸Ã³ÌÐòÎÞʵ¼ÊÒâÒå¡£
ÎÒÍÆ²âËüÖ÷ÒªÊÇÓÃÓÚ½Ìѧ¡£
7Â¥2013-10-22 12:50:06
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

xmcrobbie

Òø³æ (СÓÐÃûÆø)

ÒýÓûØÌû:
7Â¥: Originally posted by coolslj at 2013-10-22 12:50:06
Â¥Ö÷ûÓÐÌṩ¸Ã³ÌÐòµÄ±³¾°ºÍÉÏÏÂÎÄ£¬ËùÒÔר¼ÒÃÇÓеãäÈËÃþÏó¡£

¸Ã³ÌÐò¸ù¾ÝÒ»¸ö·Ö²¼µÄÖ±·½Í¼£¬²úÉúÁËÒ»¸öеķֲ¼µÄÖ±·½Í¼¡£
´ÓÕâ¸ö½Ç¶È¿´£¬¸Ã³ÌÐòÎÞʵ¼ÊÒâÒå¡£
ÎÒÍÆ²âËüÖ÷ÒªÊÇÓÃÓÚ½Ìѧ¡£...

function res = searchImCostTRandEndc (im,len,wid,MAX_NUM,thresh,currAngles)
%[res,respOut] = getSegments (im,frameNum,len,wid,thresh,currAngles)
%Searches binary im for patches of size len by wid of white
%Randomized version, thresh is the number of examples to return

SUPPRESS = 0;
SCALE = 1/3; %When we weight the background flanks by .5
%SCALE = 1/2;

%We want our final log potentials to be between 0 & 10
%FINAL_SCALE = 1/3;

[origY, origX, dummy] = size(im);


if ~exist('currAngles'),
  currAngles = 15:15:360;
  %currAngles = 15:15:180;
end
if ~exist('roi'),
  roi = [1 1;origY origX];
end

%Thresh is the number of pixels we're allowing to be misclassified
if ~exist('thresh') | isempty(thresh),
    %thresh = 1*len*wid;
    thresh = 0;
end

%Convert to a probability
%thresh = exp(-thresh/SCALE);

%Add the size of our patch to buffer our ROI
roi = round(roi + max([len wid])*[-1 -1;1 1]);

%Make sure ROI does not exceed our image dimensions
roi(1, = max([1 1],roi(1,);
roi(2, = min([origY origX],roi(2,);

%dtheta = 15;
ddir = 1; %Maybe go back to 2?
ddir = min(length(currAngles)-1,ddir);
dpos = 1; %Maybe go back to 2?

im = im(roi(1,1):roi(2,1),roi(1,2):roi(2,2),;
[imy,imx,dummy] = size(im);

%Shift our currentAngle
currAngles = -90 - currAngles;

[len,wid] = deal(round(len),round(wid));

%im = uint8(im);
%wwid = ceil(wid/8);
%wwid = 2;

%imPatch = [zeros(len,wid) ones(len,wid) zeros(len,wid)];
%Use felzenswchab style likelihood
%imPatch = [zeros(wid,wid*3); -ones(len,wid) ones(len,wid) -ones(len,wid); -ones(wid,wid*3)];

yy = [-(len-1)/2len-1)/2].^2/(.4*len.^2);
xx = [-(wid-1)/2wid-1)/2].^2/(.4*wid.^2);
[yy,xx] = ndgrid(yy,xx);
kk = exp(-(yy + xx));
kk = kk.*(len*wid/(sum(kk()));
imPatch = [zeros(wid,wid*3); -ones(len,wid) kk -ones(len,wid); -ones(wid,wid*3)];

%yind = 1:len; yind = yind - mean(yind);
%xind = 1:wid; xind = xind - mean(xind);
%[Y,X] = ndgrid(yind/(5*len),xind/(5*wid));
%imPatch = exp(-Y.^2 + -X.^2);

resp = zeros([length(currAngles) imy imx]);
for dir = 1:length(currAngles),
  currAngle = -90 - currAngles(dir);
  kernal = imrotate(imPatch,currAngle);

  %kernal = kernal./sum(kernal();  
  %kernal = kernal./sum(kernal(kernal > 0));

  [mm,nn,dummy] = size(kernal);
  
  %currResp = filter2(kernal == 1,im == 0,'valid') + .5*filter2(kernal == 0,im == 1,'valid');
  %tmp = filter2(kernal == 1,im == 0,'valid');
  tmp = filter2(kernal.*(kernal > 0),im == 0,'valid');
  currResp = tmp + .25*filter2(kernal < 0,im == 1,'valid');
  indy = ceil(mm/2):imy-floor(mm/2);
  indx = ceil(nn/2):imx-floor(nn/2);
  if ~isempty(currResp),
    %resp(dir,indy,indx) = exp(-currResp/SCALE);  
    %currResp = exp(-currResp/SCALE);
    currResp = exp(-currResp/(len*wid*SCALE));
    %currResp(tmp == sum(kernal( == 1)) = 0;
    currResp(tmp == sum(kernal(kernal > 0))) = 0;
    resp(dir,indy,indx) = currResp;
  end
end

%keyboard;
resp(resp < thresh) = 0;
%ord = find(sampleWithR(exp(-resp(/(len*wid)),thresh));

%%%%%%%%%%%%ÔÚÕâÀïµ÷ÓÃÁËsampleWithR%%%%%%%
ord = find(sampleWithR(resp(,MAX_NUM));
resp = resp(ord);
[resp,I] = sort(resp);
resp = flipud(resp);
ord = ord(flipud(I));
%ord = ord(I);

res.resp = resp;
%res.resp = resp.^(1/FINAL_SCALE);

[ang i j] = ndgrid(pi/180*currAngles,roi(1,1):roi(2,1), roi(1,2):roi(2,2));

res.resp = resp;
ang = ang(ord); res.u = cos(ang); res.v = sin(ang);
res.x = j(ord);
res.y = i(ord);
res.len = len/2*ones(size(resp));
res.w = wid/2*ones(size(resp));
8Â¥2013-10-22 14:30:50
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

xmcrobbie

Òø³æ (СÓÐÃûÆø)

´úÂëÌ«³¤£¬×¨¼ÒÃÇÓпհïÎÒ¿´¿´Ã´£¬ÎÒ¿´ÁËÒ»¸öÐÇÆÚÁË£¬»¹ÊÇû¸ã¶®£¡
9Â¥2013-10-22 14:34:02
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ xmcrobbie µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] ÉúÎïѧ071000 329·ÖÇóµ÷¼Á +3 ÎÒ°®ÉúÎïÉúÎﰮΠ2026-03-17 3/150 2026-03-18 10:12 by macy2011
[¿¼ÑÐ] 297Çóµ÷¼Á +4 Ï·¾«µ¤µ¤µ¤ 2026-03-17 4/200 2026-03-18 09:32 by zhukairuo
[¿¼ÑÐ] 268Çóµ÷¼Á +6 ¼òµ¥µã0 2026-03-17 6/300 2026-03-18 09:04 by Î޼ʵIJÝÔ­
[¿¼ÑÐ] 311Çóµ÷¼Á +10 ¶¬Ê®Èý 2026-03-15 11/550 2026-03-18 09:04 by zhukairuo
[¿¼ÑÐ] ¡¾0856¡¿»¯Ñ§¹¤³Ì£¨085602£©313 ·Ö£¬±¾¿ÆÑ§¿ÆÆÀ¹ÀAÀàԺУ»¯Ñ§¹¤³ÌÓ빤ÒÕ£¬³ÏÇóµ÷¼Á +7 СÁõ¿ì¿ìÉϰ¶ 2026-03-11 8/400 2026-03-17 16:57 by ruiyingmiao
[¿¼²©] 26É격 +4 °ËÑ®ËÙÀÀ 2026-03-16 4/200 2026-03-17 13:00 by ÇáËɲ»ÉÙËæ
[¿¼ÑÐ] 211±¾£¬11408Ò»Ö¾Ô¸ÖпÆÔº277·Ö£¬ÔøÔÚÖпÆÔº×Ô¶¯»¯Ëùʵϰ +6 Losir 2026-03-12 7/350 2026-03-17 12:09 by danranxie
[¿¼ÑÐ] [µ¼Ê¦ÍƼö]Î÷ÄϿƼ¼´óѧ¹ú·À/²ÄÁϵ¼Ê¦ÍƼö +3 ¼â½ÇСºÉ 2026-03-16 6/300 2026-03-16 23:21 by ¼â½ÇСºÉ
[¿¼ÑÐ] 286Çóµ÷¼Á +3 lemonzzn 2026-03-16 5/250 2026-03-16 20:43 by lemonzzn
[¿¼ÑÐ] Ò»Ö¾Ô¸»ªÖÐʦ·¶071000£¬325Çóµ÷¼Á +6 RuitingC 2026-03-12 6/300 2026-03-16 14:50 by ¿Éµ­²»¿ÉÍü
[¿¼ÑÐ] 0856ר˶279Çóµ÷¼Á +5 ¼ÓÓͼÓÓÍ£¡? 2026-03-15 5/250 2026-03-15 11:58 by 2020015
[¿¼ÑÐ] Öпƴó²ÄÁÏÓ뻯¹¤319Çóµ÷¼Á +3 ÃÏöβÄÁÏ 2026-03-14 3/150 2026-03-14 20:10 by ms629
[¿¼ÑÐ] 289Çóµ÷¼Á +4 ÕâôÃû×ÖÕ¦Ñù 2026-03-14 6/300 2026-03-14 18:58 by userper
[¿¼ÑÐ] ¸´ÊÔµ÷¼Á +3 ºôºô£¿~+123456 2026-03-14 3/150 2026-03-14 16:53 by WTUChen
[¿¼ÑÐ] ¡¾0703»¯Ñ§µ÷¼Á¡¿-Ò»Ö¾Ô¸»ªÖÐʦ·¶´óѧ-Áù¼¶475 +5 Becho359 2026-03-11 5/250 2026-03-14 11:35 by ŶŶ123
[¿¼ÑÐ] 304Çóµ÷¼Á +6 Mochaaaa 2026-03-12 7/350 2026-03-13 22:18 by ÐÇ¿ÕÐÇÔÂ
[¿¼ÑÐ] 308Çóµ÷¼Á +5 ÊÇLupa°¡ 2026-03-11 5/250 2026-03-13 22:13 by JourneyLucky
[¿¼ÑÐ] 0703»¯Ñ§Ò»Ö¾Ô¸211 ×Ü·Ö320Çóµ÷¼Á +5 Â꿨°Í¿¨°¡¹þ 2026-03-11 5/250 2026-03-13 21:40 by JourneyLucky
[¿¼ÑÐ] ¹¤¿Æ278·ÖÇóµ÷¼Á +5 ÖÜÂýÈȰ¡ 2026-03-12 7/350 2026-03-13 15:49 by JourneyLucky
[¿¼ÑÐ] һ־Ըɽ´ó07»¯Ñ§ 332·Ö ËÄÁù¼¶Òѹý ±¾¿ÆÉ½¶«Ë«·Ç Çóµ÷¼Á£¡ +3 ²»ÏëÀíÄã 2026-03-12 3/150 2026-03-13 14:18 by JourneyLucky
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û