Skip to main content

All Questions

Tagged with
23 questions with no upvoted or accepted answers
4 votes
0 answers
3k views

Distance transform on image using NumPy

I would like to find the find the distance transform of a binary image in the fastest way possible without using the scipy function distance_transform_edt(). The ...
user186901's user avatar
4 votes
0 answers
1k views

numpy 2d array anti diagonal averaging

The following piece of code averages the ante-diagonal elements of a 2d array x of size (m,n) with, for my purpose, m > n. ...
Delforge's user avatar
  • 228
3 votes
0 answers
103 views

E-car-sharing problem with charging between the bookings

I am writing code that, at some later point, will be part of an academic multi-agent simulation of the learning process of car-sharing users and grid stability. This code deals with finding the price ...
Andreas Schuldei's user avatar
3 votes
0 answers
66 views

Implementation of a crypto formula in Python

I need to implement in Python the formula in the image. The set B is a set of real numbers \$-1 \le t \le 1\$. Also, \$\mathbb{F}_2\$ is a set with the elements 0 and 1. \$y_i\$ is the \$i\$-th ...
juaninf's user avatar
  • 139
3 votes
0 answers
93 views

Data set generation with Python and Matplotlib

I want to use Python and Matplotlib to create a data set of images. I want to do this by transforming the plot to a numpy matrix. At the moment it takes about 0.1 second to generate 100 images of size ...
Gilfoyle's user avatar
  • 1,125
3 votes
0 answers
47 views

Deriving incremental feature representations for bit flips

Given a boolean 3D matrix and a set of actions specifying bit flips at certain positions, a set of resulting matrices can be obtained, one matrix for each action, as if executing each bit flip ...
tsorn's user avatar
  • 285
3 votes
0 answers
505 views

pandas time-based qcut

I have a dataframe pairs where each row is a transaction with corresponding price and date. Now, I need to assign each transaction to a quintile (add a new column), ...
Philipp_Kats's user avatar
3 votes
1 answer
157 views

Snake from the viewpoint of the snake

I wrote a little game of snake that where you can see the field in which the snake moves fixed and you can also see the "viewpoint" of the snake, which is basically calculating the positions ...
Javier Camacho's user avatar
2 votes
0 answers
139 views

Convolution layer using numpy in python

I'm trying to make a CNN in python using numpy. I have a finished product but it seems that it can be improved. On testing the convolutional layer is the biggest bottleneck ...
Rohith's user avatar
  • 21
2 votes
0 answers
80 views

Profiling for Bézier curve calculations

Recently I posted an answer on a question about Bézier curve calculations. As a micro-synopsis: there are three implementations of De Casteljau's algorithm here, including the original poster's, AJ ...
Reinderien's user avatar
  • 62.8k
2 votes
0 answers
59 views

Generate Black and White confidence map masks for joints, same as OpenPose/Convolutional Pose Machines

Attached below is my code for generating the confidence maps for the joint locations, it is in the same vein as the maps generated for the paper Convolutional Pose Machines and OpenPose. I am ...
ADA's user avatar
  • 121
2 votes
0 answers
148 views

Python list operation - merge adjacent cubes into minimum number of shapes

I am hoping to find a way to make the process a lot faster. The lists are made of rows of 6 numbers, i.e. [[float] * 6, ...]. The intent is to pass a list of cube ...
alex.l's user avatar
  • 21
2 votes
0 answers
116 views

Extract cell values from multiband rasters

I have the following function and code snippet to extract cell values for multiple years, format it, and save to a list. Each raster has 365 bands — one for each day. A separate operation is performed ...
Ibe's user avatar
  • 121
2 votes
0 answers
150 views

Calculate average round cell value from each 2D array cell

I am try to practice the leetcode and hit the following question 'image smooth'. Basically the question is to calculate average the around cell value from a 2D array. I have following code. But if ...
jacobcan118's user avatar
2 votes
0 answers
174 views

Live plot with many subplots

I have a stream of sensor data which I want to visualize in a plot with many subplots. Plotting the data is a real bottleneck in my code. Right now I get with small resolution only 16 FPS which is far ...
Gilfoyle's user avatar
  • 1,125

15 30 50 per page