Znn3bq.jpeg
±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 1398  |  »Ø¸´: 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 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] Çóµ÷¼Á²ÄÁÏ¿ÆÑ§Ó빤³ÌÒ»Ö¾Ô¸985³õÊÔ365·Ö +3 ²Ä»¯Àî¿É 2026-04-08 3/150 2026-04-08 11:46 by zzucheup
[¿¼ÑÐ] 264Çóµ÷¼Á +9 ÂóС¶£µ± 2026-04-07 9/450 2026-04-08 01:52 by Linzejun
[¿¼ÑÐ] ¼ÆËã»ú11408 287 Çóµ÷¼Á +3 LiLe5 2026-04-07 3/150 2026-04-07 23:15 by shanqishi
[¿¼ÑÐ] 326Çóµ÷¼Á +5 9ahye 2026-04-02 6/300 2026-04-07 21:37 by lijunpoly
[¿¼ÑÐ] ±¾¿ÆÉúÎïÐÅϢѧ£¬×Ü·Ö362 Çó07 08µ÷¼Á +6 qСٻ1210 2026-04-06 6/300 2026-04-07 19:40 by macy2011
[¿¼ÑÐ] 081200-11408-276ѧ˶Çóµ÷¼Á +6 ´Þwj 2026-04-02 6/300 2026-04-07 18:45 by Çóµ÷¼Ázz
[¿¼ÑÐ] 327¿¼Ñе÷¼ÁÍÆ¼ö +6 ÎØÎØÎØÎØÄØ 2026-04-06 6/300 2026-04-06 21:39 by à£à£à£0119
[¿¼ÑÐ] ¹¤¿Æ370Çóµ÷¼Á +3 äçÐļ弦µ° 2026-04-05 3/150 2026-04-06 10:55 by ÕâÊÇÒ»¸öÎÞÁĵÄê
[¿¼ÑÐ] µ÷¼Á Ò»Ö¾Ô¸¼ªÁÖ´óѧ357·Ö +5 .Starry. 2026-04-04 5/250 2026-04-06 09:28 by cql1109
[¿¼ÑÐ] 262Çóµ÷¼Á +7 ÌìϵÚÒ»ÎÄ 2026-04-04 8/400 2026-04-05 21:31 by ¼¤Á÷Ó¶É
[¿¼ÑÐ] 301Çóµ÷¼Á +3 XYPLR 2026-04-05 4/200 2026-04-05 19:07 by XYPLR
[¿¼ÑÐ] Çó +5 »¯¹¤×¨Ë¶323·Ö 2026-04-04 5/250 2026-04-05 08:02 by 544594351
[¿¼ÑÐ] 311·Ö 22408 Çóµ÷¼Á +3 bing_bot 2026-04-03 3/150 2026-04-05 00:43 by chongya
[¿¼ÑÐ] Ò»Ö¾Ô¸Ö£´ó0705Çóµ÷¼Á +3 éÙʮһ 2026-04-02 4/200 2026-04-05 00:05 by chongya
[¿¼ÑÐ] 277Çóµ÷¼Á +4 12A3 2026-04-02 5/250 2026-04-04 20:28 by À¶ÔÆË¼Óê
[¿¼ÑÐ] ²ÄÁÏרҵ383Çóµ÷¼Á +8 ¹ùÑôÑôÑô³É 2026-04-03 8/400 2026-04-04 10:29 by Rednal.
[¿¼ÑÐ] 303Çóµ÷¼Á +3 һɫÇåÓð 2026-04-02 4/200 2026-04-03 10:22 by À¶ÔÆË¼Óê
[¿¼ÑÐ] Ò»Ö¾Ô¸±±¾©¿Æ¼¼´óѧ085601²ÄÁϹ¤³ÌÓ¢Ò»Êý¶þ³õÊÔ×Ü·Ö335Çóµ÷¼Á +8 Ë«ÂíβƦÀϰå2 2026-04-02 9/450 2026-04-02 14:45 by 5896
[¿¼ÑÐ] ÄÜÔ´¶¯Á¦ µ÷¼Á +3 ²»ÆÆ²»Á¢0 2026-04-02 3/150 2026-04-02 12:46 by ffffjjjj
[¿¼ÑÐ] 353Çóµ÷¼Á +4 À­¹³²»Ðí±ä 2026-04-01 4/200 2026-04-01 18:10 by ¼Çʱ¾2026
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û