Znn3bq.jpeg
±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 1399  |  »Ø¸´: 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 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] »¯Ñ§¹¤³Ìµ÷¼Á289 +24 yangæÃ 2026-04-07 25/1250 2026-04-08 11:39 by Öí»á·É
[¿¼ÑÐ] Ò»Ö¾Ô¸211£¬0703»¯Ñ§305·ÖÇóµ÷¼Á +15 ÑÏÎ÷Î÷Ï· 2026-04-06 19/950 2026-04-08 09:17 by oooqiao
[¿¼ÑÐ] 304Çóµ÷¼Á +10 ËØÄê¼ÀÓï 2026-04-06 17/850 2026-04-08 09:05 by À¶ÔÆË¼Óê
[¿¼ÑÐ] ÉúÎïµ÷¼Á +5 ³È×Ó³È×Ó³È×Ó°¡ 2026-04-05 9/450 2026-04-07 15:31 by Éϰ¶¿ì¿ì
[¿¼ÑÐ] µ÷¼Á +4 mcbbc 2026-04-06 5/250 2026-04-07 12:33 by upczlm1989
[¿¼ÑÐ] Èí¹¤Ñ§Ë¶299Çóµ÷¼Á +6 useryy 2026-04-07 6/300 2026-04-07 09:50 by vgtyfty
[¿¼ÑÐ] Ò»Ö¾Ô¸ÉϺ£º£Ñó´óѧ083200ʳƷѧ˶£¬Çóµ÷¼Á£¬½ÓÊÜÆäËûרҵ +9 whatÕÅ 2026-04-01 11/550 2026-04-07 09:45 by momoð©
[¿¼ÑÐ] ¹¤¿Æ370Çóµ÷¼Á +3 äçÐļ弦µ° 2026-04-05 3/150 2026-04-06 10:55 by ÕâÊÇÒ»¸öÎÞÁĵÄê
[¿¼ÑÐ] 358Çóµ÷¼Á +7 Çïgk 2026-04-04 7/350 2026-04-05 13:29 by huangmoli
[¿¼ÑÐ] ±¾¿Æ211 ·ÖÊý293ÇëÇóµ÷¼Á +4 Á«²Ë¾ÍÊÇź°É 2026-04-01 4/200 2026-04-04 22:32 by hemengdong
[¿¼ÑÐ] 22408Çóµ÷¼Á 354·Ö ¿É¿çרҵ +3 hannnnnnn 2026-04-04 3/150 2026-04-04 14:35 by ÍÁľ˶ʿÕÐÉú
[¿¼ÑÐ] ²ÄÁÏרҵ383Çóµ÷¼Á +8 ¹ùÑôÑôÑô³É 2026-04-03 8/400 2026-04-04 10:29 by Rednal.
[¿¼ÑÐ] ÇóÉúÎïѧרҵµ÷¼Á-332·Ö +5 ÔÆ¶äåÞÍäÖ¸ÄÏ 2026-04-04 5/250 2026-04-04 10:05 by rzh123456
[¿¼ÑÐ] 387Çóµ÷¼Á +4 °®³ÔƬ¶¹ÍÁ 2026-04-03 5/250 2026-04-04 08:10 by °¶ÉϵÄÒ»ÌõÓã
[¿¼ÑÐ] µ÷¼Á +5 asdasdassda 2026-04-03 6/300 2026-04-03 20:27 by °¶ÉϵÄÒ»ÌõÓã
[¿¼ÑÐ] 274Çóµ÷¼Á +9 ˳Àí³ÉÕÅ 2026-04-03 10/500 2026-04-03 15:10 by °¡¿¡£¡
[¿¼ÑÐ] ¹¤¿Æ 267Çóµ÷¼Á +5 wanwan00 2026-04-02 7/350 2026-04-03 14:14 by zhangdingwa
[¿¼ÑÐ] 315·Ö 085602 Çóµ÷¼Á +15 26¿¼ÑÐÉϰ¶°æ26 2026-04-02 15/750 2026-04-03 12:45 by xingguangj
[¿¼ÑÐ] 262Çóµ÷¼Á +6 ÀøÖ¾Ò»¶¨·¢ÎÄÕ 2026-04-02 7/350 2026-04-03 09:54 by linyelide
[¿¼ÑÐ] 348»·¾³¹¤³Ìµ÷¼Á +3 ÎâÑå׿24k 2026-04-01 3/150 2026-04-02 09:14 by nanaliuyun
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û