将遵循方向的点集分组在一起的算法

2024-03-30

注意:我将这个问题放在 MATLAB 和 Python 标签中,因为我最精通这些语言。但是,我欢迎任何语言的解决方案。


问题序言

我用鱼眼镜头拍摄了一张图像。该图像由带有一堆方形物体的图案组成。我想要对该图像执行的操作是检测每个正方形的质心,然后使用这些点对图像进行去畸变 - 具体来说,我正在寻找正确的畸变模型参数。应该注意的是,并不是所有的方块都需要被检测到。只要他们中的大多数人都是这样,那就完全没问题......但这不是这篇文章的重点。我已经编写了参数估计算法,但问题是它需要图像中出现共线的点。

我想问的基本问题是给定这些点,将它们分组在一起以便每个组由水平线或垂直线组成的最佳方法是什么?

我的问题的背景

对于我要问的问题来说,这并不重要,但如果您想知道我从哪里获得数据并进一步了解我要问的问题,请阅读。如果你不感兴趣,那么你可以直接跳到问题设置下面的部分。


我正在处理的图像示例如下所示:

这是一张 960 x 960 的图像。该图像最初的分辨率较高,但我对图像进行了二次采样,以加快处理时间。正如您所看到的,图像中分散着一堆方形图案。另外,我计算的质心是相对于上面的二次采样图像的。

我设置的用于检索质心的管道如下:

  1. 执行 Canny 边缘检测
  2. 专注于最大程度减少误报的感兴趣区域。该感兴趣区域基本上是没有任何黑色胶带覆盖其一侧的正方形。
  3. 找到所有不同的闭合轮廓
  4. 对于每个不同的闭合轮廓...

    A。执行 Harris 角点检测

    b.判断结果是否有4个角点

    C。如果是这样,那么这个轮廓属于一个正方形并找到这个形状的质心

    d.如果没有,则跳过此形状

  5. 将步骤 #4 中检测到的所有质心放入矩阵中以供进一步检查。

这是上图的示例结果。每个检测到的方块都有四个点,根据其相对于方块本身的位置进行颜色编码。对于我检测到的每个质心,我会在图像本身中该质心所在的位置写入一个 ID。

在上图中,检测到了 37 个正方形。

问题设置

假设我有一些图像像素点存储在N x 3矩阵。前两列是x(水平)和y(垂直)坐标,在图像坐标空间中,y坐标是inverted,这意味着正y向下移动。第三列是与该点关联的 ID。

下面是用 MATLAB 编写的一些代码,它获取这些点,将它们绘制到二维网格上,并用矩阵的第三列标记每个点。如果您阅读了上述背景,这些就是我上面概述的算法检测到的点。

data = [ 475.  ,  605.75,    1.;
       571.  ,  586.5 ,    2.;
       233.  ,  558.5 ,    3.;
       669.5 ,  562.75,    4.;
       291.25,  546.25,    5.;
       759.  ,  536.25,    6.;
       362.5 ,  531.5 ,    7.;
       448.  ,  513.5 ,    8.;
       834.5 ,  510.  ,    9.;
       897.25,  486.  ,   10.;
       545.5 ,  491.25,   11.;
       214.5 ,  481.25,   12.;
       271.25,  463.  ,   13.;
       646.5 ,  466.75,   14.;
       739.  ,  442.75,   15.;
       340.5 ,  441.5 ,   16.;
       817.75,  421.5 ,   17.;
       423.75,  417.75,   18.;
       202.5 ,  406.  ,   19.;
       519.25,  392.25,   20.;
       257.5 ,  382.  ,   21.;
       619.25,  368.5 ,   22.;
       148.  ,  359.75,   23.;
       324.5 ,  356.  ,   24.;
       713.  ,  347.75,   25.;
       195.  ,  335.  ,   26.;
       793.5 ,  332.5 ,   27.;
       403.75,  328.  ,   28.;
       249.25,  308.  ,   29.;
       495.5 ,  300.75,   30.;
       314.  ,  279.  ,   31.;
       764.25,  249.5 ,   32.;
       389.5 ,  249.5 ,   33.;
       475.  ,  221.5 ,   34.;
       565.75,  199.  ,   35.;
       802.75,  173.75,   36.;
       733.  ,  176.25,   37.];

figure; hold on;
axis ij;
scatter(data(:,1), data(:,2),40, 'r.');
text(data(:,1)+10, data(:,2)+10, num2str(data(:,3)));

类似地,在 Python 中,使用numpy and matplotlib, 我们有:

import numpy as np
import matplotlib.pyplot as plt

data = np.array([[ 475.  ,  605.75,    1.  ],
   [ 571.  ,  586.5 ,    2.  ],
   [ 233.  ,  558.5 ,    3.  ],
   [ 669.5 ,  562.75,    4.  ],
   [ 291.25,  546.25,    5.  ],
   [ 759.  ,  536.25,    6.  ],
   [ 362.5 ,  531.5 ,    7.  ],
   [ 448.  ,  513.5 ,    8.  ],
   [ 834.5 ,  510.  ,    9.  ],
   [ 897.25,  486.  ,   10.  ],
   [ 545.5 ,  491.25,   11.  ],
   [ 214.5 ,  481.25,   12.  ],
   [ 271.25,  463.  ,   13.  ],
   [ 646.5 ,  466.75,   14.  ],
   [ 739.  ,  442.75,   15.  ],
   [ 340.5 ,  441.5 ,   16.  ],
   [ 817.75,  421.5 ,   17.  ],
   [ 423.75,  417.75,   18.  ],
   [ 202.5 ,  406.  ,   19.  ],
   [ 519.25,  392.25,   20.  ],
   [ 257.5 ,  382.  ,   21.  ],
   [ 619.25,  368.5 ,   22.  ],
   [ 148.  ,  359.75,   23.  ],
   [ 324.5 ,  356.  ,   24.  ],
   [ 713.  ,  347.75,   25.  ],
   [ 195.  ,  335.  ,   26.  ],
   [ 793.5 ,  332.5 ,   27.  ],
   [ 403.75,  328.  ,   28.  ],
   [ 249.25,  308.  ,   29.  ],
   [ 495.5 ,  300.75,   30.  ],
   [ 314.  ,  279.  ,   31.  ],
   [ 764.25,  249.5 ,   32.  ],
   [ 389.5 ,  249.5 ,   33.  ],
   [ 475.  ,  221.5 ,   34.  ],
   [ 565.75,  199.  ,   35.  ],
   [ 802.75,  173.75,   36.  ],
   [ 733.  ,  176.25,   37.  ]])

plt.figure()
plt.gca().invert_yaxis()

plt.plot(data[:,0], data[:,1], 'r.', markersize=14)

for idx in np.arange(data.shape[0]):
    plt.text(data[idx,0]+10, data[idx,1]+10, str(int(data[idx,2])), size='large')

plt.show()

We get:


回到问题

正如您所看到的,这些点或多或少呈网格图案,您可以看到我们可以在点之间形成线条。具体来说,你可以看到有可以水平和垂直形成的线条。

例如,如果您引用我的问题的背景部分中的图像,我们可以看到有 5 组点可以以水平方式分组。例如,点 23、26、29、31、33、34、35、37 和 36 形成一组。点 19、21、24、28、30 和 32 形成另一组,依此类推。同样,在垂直方向上,我们可以看到点 26、19、12 和 3 形成一组,点 29、21、13 和 5 形成另一组,依此类推。


要问的问题

我的问题是这样的:考虑到点可以处于任何方向,有什么方法可以成功地分别将水平分组和垂直分组中的点分组?

状况

  1. There 必须至少为三个每行点数。如果有任何低于此的内容,则这不符合分段的资格。因此,点 36 和 10 不符合垂直线的条件,并且类似地,孤立点 23 不应该符合垂直线的条件,但它是第一水平分组的一部分。

  2. 上述校准图案可以处于任何方向。然而,对于我正在处理的问题,您可以获得的最糟糕的方向是您在上面的背景部分中看到的。


预期输出

输出将是一对列表,其中第一个列表包含元素,其中每个元素为您提供形成水平线的点 ID 序列。同样,第二个列表包含一些元素,其中每个元素为您提供一系列形成垂直线的点 ID。

因此,水平序列的预期输出将如下所示:

MATLAB

horiz_list = {[23, 26, 29, 31, 33, 34, 35, 37, 36], [19, 21, 24, 28, 30, 32], ...};
vert_list = {[26, 19, 12, 3], [29, 21, 13, 5], ....};

Python

horiz_list = [[23, 26, 29, 31, 33, 34, 35, 37, 36], [19, 21, 24, 28, 30, 32], ....]
vert_list = [[26, 19, 12, 3], [29, 21, 13, 5], ...]

我尝试过的

从算法上讲,我尝试的是撤消在这些点上经历的旋转。我表演过主成分分析 http://en.wikipedia.org/wiki/Principal_component_analysis我尝试根据计算的正交基向量投影这些点,以便这些点或多或少位于直矩形网格上。

一旦我有了它,这只是进行一些扫描线处理的简单问题,您可以根据水平或垂直坐标上的差异变化对点进行分组。您可以通过以下任一方式对坐标进行排序x or y值,然后检查这些排序的坐标并寻找较大的变化。一旦遇到这种变化,您就可以将变化之间的点组合在一起以形成线条。对每个维度执行此操作将为您提供水平或垂直分组。

关于 PCA,这是我在 MATLAB 和 Python 中所做的:

MATLAB

%# Step #1 - Get just the data - no IDs
data_raw = data(:,1:2);

%# Decentralize mean
data_nomean = bsxfun(@minus, data_raw, mean(data_raw,1));

%# Step #2 - Determine covariance matrix
%# This already decentralizes the mean
cov_data = cov(data_raw);

%# Step #3 - Determine right singular vectors
[~,~,V] = svd(cov_data);

%# Step #4 - Transform data with respect to basis
F = V.'*data_nomean.';

%# Visualize both the original data points and transformed data
figure;
plot(F(1,:), F(2,:), 'b.', 'MarkerSize', 14);
axis ij;
hold on;
plot(data(:,1), data(:,2), 'r.', 'MarkerSize', 14);

Python

import numpy as np
import numpy.linalg as la

# Step #1 and Step #2 - Decentralize mean
centroids_raw = data[:,:2]
mean_data = np.mean(centroids_raw, axis=0)

# Transpose for covariance calculation
data_nomean = (centroids_raw - mean_data).T

# Step #3 - Determine covariance matrix
# Doesn't matter if you do this on the decentralized result
# or the normal result - cov subtracts the mean off anyway
cov_data = np.cov(data_nomean)

# Step #4 - Determine right singular vectors via SVD
# Note - This is already V^T, so there's no need to transpose
_,_,V = la.svd(cov_data)

# Step #5 - Transform data with respect to basis
data_transform = np.dot(V, data_nomean).T

plt.figure()
plt.gca().invert_yaxis()

plt.plot(data[:,0], data[:,1], 'b.', markersize=14)
plt.plot(data_transform[:,0], data_transform[:,1], 'r.', markersize=14)

plt.show()

上面的代码不仅重新投影数据,而且还将原始点和投影点一起绘制在一张图中。然而,当我尝试重新投影我的数据时,这是我得到的图:

红色的点是原始图像坐标,而蓝色的点被重新投影到基础向量上以尝试消除旋转。它仍然没有完全完成这项工作。这些点仍然存在一些方向,因此如果我尝试执行扫描线算法,则水平跟踪下方的线或垂直跟踪侧面的点将无意中分组,这是不正确的。


也许我对这个问题想得太多了,但是如果您对此有任何见解,我们将不胜感激。如果答案确实很棒,我会倾向于给予高额赏金,因为我已经在这个问题上停留了很长一段时间了。

我希望这个问题不是冗长的。如果您不知道如何解决这个问题,那么无论如何,我感谢您花时间阅读我的问题。

期待您的任何见解。非常感谢!


注 1:它有许多设置 -> 对于其他图像可能需要更改这些设置才能获得您想要的结果请参阅 % 设置 - 尝试使用这些值

注 2:它没有找到您想要的所有行 -> 但它是一个起点......

要调用此函数,请在命令提示符中调用:

>> [h, v] = testLines;

We get:

>> celldisp(h)

h{1} =
     1     2     4     6     9    10
h{2} =
     3     5     7     8    11    14    15    17
h{3} =
     1     2     4     6     9    10
h{4} =
     3     5     7     8    11    14    15    17
h{5} =
     1     2     4     6     9    10
h{6} =
     3     5     7     8    11    14    15    17
h{7} =
     3     5     7     8    11    14    15    17
h{8} =
     1     2     4     6     9    10
h{9} =
     1     2     4     6     9    10
h{10} =
    12    13    16    18    20    22    25    27
h{11} =
    13    16    18    20    22    25    27
h{12} =
     3     5     7     8    11    14    15    17
h{13} =
     3     5     7     8    11    14    15
h{14} =
    12    13    16    18    20    22    25    27
h{15} =
     3     5     7     8    11    14    15    17
h{16} =
    12    13    16    18    20    22    25    27
h{17} =
    19    21    24    28    30
h{18} =
    21    24    28    30
h{19} =
    12    13    16    18    20    22    25    27
h{20} =
    19    21    24    28    30
h{21} =
    12    13    16    18    20    22    24    25
h{22} =
    12    13    16    18    20    22    24    25    27
h{23} =
    23    26    29    31    33    34    35
h{24} =
    23    26    29    31    33    34    35    37
h{25} =
    23    26    29    31    33    34    35    36    37
h{26} =
    33    34    35    37    36
h{27} =
    31    33    34    35    37

>> celldisp(v)
v{1} =
    33    28    18     8     1
v{2} =
    34    30    20    11     2
v{3} =
    26    19    12     3
v{4} =
    35    22    14     4
v{5} =
    29    21    13     5
v{6} =
    25    15     6
v{7} =
    31    24    16     7
v{8} =
    37    32    27    17     9

还生成一个图形,通过每个适当的点集绘制线条:

function [horiz_list, vert_list] = testLines

global counter;
global colours; 
close all;

data = [ 475.  ,  605.75,    1.;
       571.  ,  586.5 ,    2.;
       233.  ,  558.5 ,    3.;
       669.5 ,  562.75,    4.;
       291.25,  546.25,    5.;
       759.  ,  536.25,    6.;
       362.5 ,  531.5 ,    7.;
       448.  ,  513.5 ,    8.;
       834.5 ,  510.  ,    9.;
       897.25,  486.  ,   10.;
       545.5 ,  491.25,   11.;
       214.5 ,  481.25,   12.;
       271.25,  463.  ,   13.;
       646.5 ,  466.75,   14.;
       739.  ,  442.75,   15.;
       340.5 ,  441.5 ,   16.;
       817.75,  421.5 ,   17.;
       423.75,  417.75,   18.;
       202.5 ,  406.  ,   19.;
       519.25,  392.25,   20.;
       257.5 ,  382.  ,   21.;
       619.25,  368.5 ,   22.;
       148.  ,  359.75,   23.;
       324.5 ,  356.  ,   24.;
       713.  ,  347.75,   25.;
       195.  ,  335.  ,   26.;
       793.5 ,  332.5 ,   27.;
       403.75,  328.  ,   28.;
       249.25,  308.  ,   29.;
       495.5 ,  300.75,   30.;
       314.  ,  279.  ,   31.;
       764.25,  249.5 ,   32.;
       389.5 ,  249.5 ,   33.;
       475.  ,  221.5 ,   34.;
       565.75,  199.  ,   35.;
       802.75,  173.75,   36.;
       733.  ,  176.25,   37.];

figure; hold on;
axis ij;

% Change due to Benoit_11
scatter(data(:,1), data(:,2),40, 'r.'); text(data(:,1)+10, data(:,2)+10, num2str(data(:,3)));
text(data(:,1)+10, data(:,2)+10, num2str(data(:,3)));

% Process your data as above then run the function below(note it has sub functions)
counter = 0;
colours = 'bgrcmy';
[horiz_list, vert_list] = findClosestPoints ( data(:,1), data(:,2) );


function [horiz_list, vert_list] = findClosestPoints ( x, y )
  % calc length of points
  nX = length(x);
  % set up place holder flags
  modelledH = false(nX,1);
  modelledV = false(nX,1);
  horiz_list = {};
  vert_list = {};

  % loop for all points
  for p=1:nX
    % have we already modelled a horizontal line through these?
    % second last param - true - horizontal, false - vertical
    if modelledH(p)==false
      [modelledH, index] = ModelPoints ( p, x, y, modelledH, true, true );
      horiz_list = [horiz_list index];
    else
      [~, index] = ModelPoints ( p, x, y, modelledH, true, false );
      horiz_list = [horiz_list index];
    end

    % make a temp copy of the x and y and remove any of the points modelled 
    %  from the horizontal -> this  is to avoid them being found in the 
    %  second call.
    tempX = x;
    tempY = y;
    tempX(index) = NaN;
    tempY(index) = NaN;
    tempX(p) = x(p);
    tempY(p) = y(p);
    % Have we found a vertial line?
    if modelledV(p)==false
      [modelledV, index] = ModelPoints ( p, tempX, tempY, modelledV, false, true );
      vert_list = [vert_list index];
    end
  end
end
function [modelled, index] = ModelPoints ( p, x, y, modelled, method, fullRun )
  % p - row in your original data matrix
  % x - data(:,1)
  % y - data(:,2)
  % modelled - array of flags to whether rows have been modelled
  % method   - horizontal or vertical (used to calc graadients)
  % fullRun  - full calc or just to get indexes 
  %            this could be made better by storing the indexes of each horizontal in the method above

  % Settings - play around with these values 
  gradDelta = 0.2;  % find points where gradient is less than this value
  gradLimit = 0.45; % if mean gradient of line is above this ignore
  numberOfPointsToCheck = 7; % number of points to check when look along the line
                        % to find other points (this reduces chance of it
                        % finding other points far away
                        %  I optimised this for your example to be 7
                        %  Try varying it and you will see how it effect the result.

  % Find the index of points which are inline.
  [index, grad] = CalcIndex ( x, y, p, gradDelta, method );
  % check gradient of line
  if abs(mean(grad))>gradLimit
    index = [];
    return
  end
  % add point of interest to index
  index = [p index];

  % loop through all points found above to find any other points which are in
  %  line with these points (this allows for slight curvature
  combineIndex = [];
  for ii=2:length(index)
    % Find inedex of the points found above (find points on curve)
    [index2] = CalcIndex ( x, y, index(ii), gradDelta, method, numberOfPointsToCheck, grad(ii-1) );

    % Check that the point on this line are on the original (i.e. inline -> not at large angle
    if any(ismember(index,index2))
      % store points found
      combineIndex = unique([index2 combineIndex]);
    end
  end

  % copy to index
  index = combineIndex;
  if fullRun
    %  do some plotting
    %  TODO: here you would need to calculate your arrays to output.
    xx = x(index);
    [sX,sOrder] = sort(xx);
    % Check its found at least 3 points
    if length ( index(sOrder) ) > 2
      % flag the modelled on the points found
      modelled(index(sOrder)) = true;
      % plot the data
      plot ( x(index(sOrder)), y(index(sOrder)), colours(mod(counter,numel(colours)) + 1));
      counter = counter + 1;
    end
    index = index(sOrder);
  end
end  
function [index, gradCheck] = CalcIndex ( x, y, p, gradLimit, method, nPoints2Consider, refGrad )
  % x - data(:,1)
  % y - data(:,2)
  % p - point of interest
  % method (x/y) or (y\x)
  % nPoints2Consider - only look at N points (options)
  % refgrad          - rather than looking for gradient of closest point -> use this
  %                  - reference gradient to find similar points (finds points on curve)
  nX = length(x);
  % calculate gradient
  for g=1:nX
    if method
      grad(g) = (x(g)-x(p))\(y(g)-y(p));
    else
      grad(g) = (y(g)-y(p))\(x(g)-x(p));
    end
  end
  % find distance to all other points
  delta = sqrt ( (x-x(p)).^2 + (y-y(p)).^2 );
  % set its self = NaN
  delta(delta==min(delta)) = NaN;
  % find the closest points
  [m,order] = sort(delta);

  if nargin == 7
    % for finding along curve
    % set any far away points to be NaN
    grad(order(nPoints2Consider+1:end)) = NaN;
    % find the closest points to the reference gradient within the allowable limit
    index = find(abs(grad-refGrad)<gradLimit==1);
    % store output
    gradCheck = grad(index);
  else
    % find the points which are closes to the gradient of the closest point
    index = find(abs(grad-grad(order(1)))<gradLimit==1);
    % store gradients to output
    gradCheck = grad(index);
  end
end
end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将遵循方向的点集分组在一起的算法 的相关文章

  • 在 python 3 中使用子进程

    我使用 subprocess 模块在 python 3 中运行 shell 命令 这是我的代码 import subprocess filename somename py in practical i m using a real fil
  • 获取向量幂的有效方法

    我编写了一个代码 在数值上使用勒让德多项式直至某个高 n 阶 例如 case 8 p 6435 x 8 12012 x 6 6930 x 4 1260 x 2 35 128 return case 9 如果向量x太长这会变得很慢 我发现说之
  • 低质量相机的模糊内核

    我正在做一些图像增强实验 所以我用我的廉价相机拍照 相机有马赛克伪像 所有图像看起来都像网格 我认为药盒 失焦 内核和高斯内核不是最佳候选 有什么建议么 EDIT Sample 我怀疑这不能通过恒定的内核来完成 因为对像素的影响并不相同 因
  • 如何在Python中高效地添加稀疏矩阵

    我想知道如何在Python中有效地添加稀疏矩阵 我有一个程序 可以将大任务分解为子任务 并将它们分配到多个 CPU 上 每个子任务都会产生一个结果 一个 scipy 稀疏矩阵 格式为 lil matrix 稀疏矩阵尺寸为 100000x50
  • Python中列表中两个连续元素的平均值

    我有一个偶数个浮点数的列表 2 34 3 45 4 56 1 23 2 34 7 89 我的任务是计算 1 和 2 个元素 3 和 4 5 和 6 等元素的平均值 在 Python 中执行此操作的快捷方法是什么 data 2 34 3 45
  • 如何使用 javascript/jquery/AJAX 调用 Django REST API?

    我想使用 Javascript jQuery AJAX 在前端调用 Django Rest API 请求方法是 POST 但当我看到 API 调用它的调用 OPTIONS 方法时 所以 我开始了解access control allow o
  • 在相同任务上,Keras 比 TensorFlow 慢

    我正在使用 Python 运行斩首 DCNN 本例中为 Inception V3 来获取图像特征 我使用的是 Anaconda Py3 6 和 Windows7 使用 TensorFlow 时 我将会话保存在变量中 感谢 jdehesa 并
  • 设置 verify_certs=False 但 elasticsearch.Elasticsearch 因证书验证失败而引发 SSL 错误

    self host KibanaProxy 自我端口 443 self user 测试 self password 测试 我需要禁止证书验证 使用选项时它与curl一起使用 k在命令行上 但是 在使用 Elasticsearch pytho
  • 如何从 JSON 响应重定向?

    所以我尝试使用 Flask 和 Javascript 上传器 Dropzone 上传文件并在上传完成后重定向 文件上传正常 但在烧瓶中使用传统的重定向 return redirect http somesite com 不执行任何操作 页面
  • 如何在 Django 中使用基于类的视图创建注册视图?

    当我开始使用 Django 时 我几乎使用 FBV 基于函数的视图 来处理所有事情 包括注册新用户 但当我更深入地研究项目时 我意识到基于类的视图通常更适合大型项目 因为它们更干净且可维护 但这并不是说 FBV 不是 无论如何 我将整个项目
  • Python:我不明白 sum() 的完整用法

    当然 我明白你使用 sum 与几个数字 然后它总结所有 但我正在查看它的文档 我发现了这一点 sum iterable start 第二个参数 start 的作用是什么 这太尴尬了 但我似乎无法通过谷歌找到任何示例 并且对于尝试学习该语言的
  • Werkzeug 中的线程和本地代理。用法

    首先 我想确保我正确理解了功能的分配 分配本地代理功能以通过线程内的模块 包 共享变量 对象 我对吗 其次 用法对我来说仍然不清楚 也许是因为我误解了作业 我用烧瓶 如果我有两个 或更多 模块 A B 我想将对象C从模块A导入到模块B 但我
  • 在 Spyder 的变量资源管理器中查看局部变量

    我是 python 新手 正在使用 Spyder 的 IDE 我欣赏它的一项功能是它的变量资源管理器 然而 根据一些研究 我发现它只显示全局变量 我找到的解决方法是使用检查模块 import inspect local vars def m
  • 带有 RotatingFileHandler 的 Python 3 记录器超出 maxBytes 限制

    我使用以下代码来限制日志文件的大小 最小示例 import logging from logging handlers import RotatingFileHandler Set up logfile and message loggin
  • OSX 上的 locale.getlocale() 问题

    我需要获取系统区域设置来执行许多操作 最终我想使用 gettext 翻译我的应用程序 我打算在 Linux 和 OSX 上分发它 但我在 OSX Snow Leopard 上遇到了问题 python Python 2 5 2 r252 60
  • 从列表python的单个列表中删除子列表

    我已经经历过从列表列表中删除子列表 https stackoverflow com questions 47209786 removing sublists from a list of lists 但当我为我的数据集扩展它时 它不适用于我
  • 操作错误:(sqlite3.OperationalError) SQL 变量太多,同时将 SQL 与数据帧一起使用

    我有一个熊猫数据框 如下所示 activity User Id 0 VIEWED MOVIE 158d292ec18a49 1 VIEWED MOVIE 158d292ec18a49 2 VIEWED MOVIE 158d292ec18a4
  • [cocos2d-x]当我尝试在 Windows 10 中运行“python android-build.py -p 19 cpp-tests”时出现错误

    当我尝试运行命令时python android build p cpp tests 我收到如图所示的错误 在此之前 我收到了另一条关于 Android SDK Tools 版本兼容性的错误消息 所以 我只是将 sdk 版本从 26 0 0
  • python 日志记录会刷新每个日志吗?

    当我使用标准模块将日志写入文件时logging 每个日志会分别刷新到磁盘吗 例如 下面的代码会将日志刷新 10 次吗 logging basicConfig level logging DEBUG filename debug log fo
  • python 中的 after() 与 update()

    我是 python 新手 开始使用 tkinter 作为画布 到目前为止 我使用 update 来更新我的画布 但还有一个 after 方法 谁能给我解释一下这个函数 请举个例子 两者之间有什么区别 root after integer c

随机推荐

  • 获取下周一的日期

    如何在 JavaScript 中获取下周一 我在互联网上找不到任何相关内容 我也尝试了很多代码并对此有所了解 但我无法真正做到这一点 这是我的代码 var d new Date var day d getDay d new Date d s
  • 访问 PHP 中的活动会话

    如何获取服务器上所有活动 PHP 会话的列表并从一个用户的实例中访问它们 激励案例是显示网站上所有当前活动用户的列表 其中用户名存储在每个用户的 PHP 会话中 注意 我知道我可以通过数据库 甚至文件系统 创建自己的状态 但我正在寻找一种利
  • Elasticsearch - 合并多个文档中的字段

    假设我有一堆这样的文档 foo 1 2 3 foo 3 4 5 对于针对这些文档运行的查询 我正在寻找一种方法来返回所有值的数组foo 最好是唯一的值 但重复也可以 foo 1 2 3 3 4 5 我研究了聚合 API 但我不知道如何实现这
  • 缩略图点击后消失,FancyBox

    我创建了 FancyBox 画廊 但现在 当我单击缩略图时 它会按计划显示图像库 但在后台我可以看到所有缩略图都一一消失 F5 或页面重新加载后 所有缩略图都会恢复 My code a class fancybox title a a cl
  • Visual Studio 2015 预览版中的 Windows Phone 8.0 应用程序打包

    我通过我的学生 Dreamspark 帐户安装了 Visual Studio 2015 Ultimate Preview 我将其安装在更新的 Windows 8 1 之上 工作站 我有 Windows Phone 8 0 应用程序 需要将其
  • 如何冻结所有可冻结的 WPF 对象?

    我想冻结窗口中的所有可冻结对象 以获得更好的性能 为此 我使用了几个像这样的循环 foreach Brush item in FindLogicalChildren
  • 如何绘制方向箭头

    我有很多方向和角度的线条 我使用它们来绘制它们UIBezierpath 我需要在线的一端画一个箭头 动态地取决于给定点 Edit Edit 2 杰克的回答是我的代码 let y2 line point2Y let path UIBezier
  • 将自然数转换为特定基数并将其作为列表返回

    我想将函数的结果显示为列表而不是数字 我的结果是 define lst list define num gt base n b if zero n append lst list 0 append lst list 10 num gt ba
  • 如何在 HBase 中续订过期的 Kerberos 票证?

    我有一个小型 spring 服务 它提供基本功能 例如从 hbase 表中放入 删除 获取 一切似乎都正常 但有一个问题 启动 Tomcat 服务器 10 小时后 我的 kerberos 票证过期 因此我应该更新它 我尝试对 hbase 使
  • 仅在成功 Stripe Checkout 付款后才提交 Rails 表格

    我正在使用 Rails 4 2 并尝试集成 Stripe Checkout https stripe com docs checkout guides rails https stripe com docs checkout guides
  • 间隙误差。 Pandas 使用动态查询字符串过滤数据帧。

    大家好 该问题与 Python 的反向间隙错误有关 我正在创建一个动态查询字符串以在 pandas 中进行过滤 代码是 filters dict wlbWellType EXPLORATION query string index 0 fo
  • ObjectOutputStream 方法:writeBytes(String str) 与 writeUTF(String s);

    两者之间的主要区别是什么 它们仍然都是用于编写字符串 public void writeUTF String str throws IOException Primitive data write of this String in mod
  • 是否有可能在 Flutter 中动态初始化 Firebase?

    我尝试根据用户语言偏好来初始化 Firebase 例如 用户打开应用程序 选择语言A Flutter应该初始化项目A 配置等 当用户选择不同的语言时也是如此 问题是 iOS 需要有默认的 GoogleService Info plist 文
  • Selenium Ruby 绑定功能文档

    我是 Selenium Ruby 绑定的新手 我想知道可以在其中找到可用于 Ruby 驱动程序功能的选项的文档网站 我在网上搜索了一下 发现大部分与Java相关的帖子 https code google com p selenium wik
  • 控制和创建多个精灵数组 Java Libgdx

    我正在尝试创建一个具有精灵的游戏 并且每秒都会生成另一个精灵 我尝试使用它作为基础 https github com libgdx libgdx wiki A simple game https github com libgdx libg
  • java 使用外部 jar 文件构建 ant 文件

    我创建了一个 ant 构建文件来将 java src 编译为 jar 文件 它使用外部 jar 文件 我的文件目录 src android Address java HelloServer java HelloServerResource
  • 使用反应选择我遇到了下一个问题:无法读取未定义的属性“值”

    我在用着react select 当我从 select 中选择一个确定值时 我遇到了下一个问题 类型错误 无法读取未定义的属性 值 另外 从reducer获取的值todoList没有显示 我看不到它们 这是我的代码 import Selec
  • 将 ArrayList 的子列表转换为 ArrayList

    我使用 ArrayList 并尝试将其一部分复制到另一个 ArrayList 因此我使用 sibling keys ArrayList
  • 如何使浏览器缓存具有不同 aws s3 预签名 url 的相同图像?

    我生成了与此类似的 url 以便我的用户从我的 aws s3 存储桶检索图像文件 有时 用户可能会刷新页面 并且同一资源的 url 会获得一组新值Expires and Signature 浏览器会将这两个 url 视为不同的两个对象 并会
  • 将遵循方向的点集分组在一起的算法

    注意 我将这个问题放在 MATLAB 和 Python 标签中 因为我最精通这些语言 但是 我欢迎任何语言的解决方案 问题序言 我用鱼眼镜头拍摄了一张图像 该图像由带有一堆方形物体的图案组成 我想要对该图像执行的操作是检测每个正方形的质心