Posts by danieltakeshi • 3,960 points
212 posts
-
2
votes2
answers616
viewsA: Problem showing image in imshow
You’re generating the random numbers wrong, so the matrix gaussian does not have the same data type as the image. The correct way to generate a color random image would be: gaussian =…
-
1
votes2
answers928
viewsA: Create folders from cell information, with the file "test.txt" inside each folder created (VBA)
Declare as Integer First an observation: Observing: Declare the Maxrows and Maxcols like Long (Dim Maxrows As Long), because many old tutorials use Integer, which has 2 bytes and the range from -32…
-
0
votes1
answer74
viewsA: using ROW() in VBA
When using .FormulaR1C1 a formula is inserted in Excel. Then the VBA function WorksheetFunction cannot be used within an Excel function. Follow the code to get around the problem: Range("H2").Select…
vbaanswered danieltakeshi 3,960 -
2
votes1
answer1393
viewsA: Returning value via VBA
The function is being called incorrectly and VBA does not use Return functions. VBA syntax is a little different, according to the following code: Function verifica_cpf(cpf As Long) As Boolean Dim i…
-
1
votes1
answer674
viewsA: Copy and Paste data by date - Excel VBA
This is because all the cells that meet the criteria are glued together in the same place, so the last occurrence is the view. Go through the code step-by-step with F8 and you’ll realize that it…
excel-vbaanswered danieltakeshi 3,960 -
1
votes4
answers931
viewsA: Python columns excel csv
When generating a multicolumn file for Excel in en, the delimiter should be changed from , for ;. For when generating a list with the following data on each line: ("", número_aleatório,…
-
3
votes2
answers384
viewsA: How to make a ranking of the best buyers through Excel?
Dynamic tables can be used. Solution With a table as in the following example: | Produto | Nome do Comprador | Valor do produto | |---------|-------------------|------------------| | A | João | R$…
excelanswered danieltakeshi 3,960 -
2
votes1
answer1677
viewsA: Calculate percentage of certain colors in an image
Contar Pixels As the function inRange() is used, pixels can be counted with the function countNonZero(). Then the amount of pixels obtained in each inRange may be obtained as follows:: pixelsAsfalto…
-
0
votes1
answer124
viewsA: Fixed Range Macro Problem
Use the Selection, using the selected cells. With Selection.Copy you are copying the selected cells (can be manually, before executing the macro). But try to avoid using .Select/.…
-
1
votes1
answer1146
viewsQ: What is video frame interpolation (video frame Interpolation)?
Reading some news I came across this: Transforming Standard Video Into Slow Motion with AI or NVIDIA AI creates slow motion videos without "recording more frames", where Nvidia used an algorithm…
-
0
votes1
answer166
viewsA: How to use pandas styling properly?
The syntax df_html = df.style.render() is wrong if df is not a dataframe, as the input parameter of Styler is a dataframe. So with: df = df.style.highlight_max(axis=0) df_html = df.style.render()…
-
2
votes1
answer166
viewsQ: How to use pandas styling properly?
Python code From the examples of documentation the following code has been created: import pandas as pd import os import webbrowser import io def highlight_max(s): ''' highlight the maximum in a…
-
1
votes3
answers125
viewsA: Sum of intervals
If the problem has values increasing the way it is proposed (0.58; 0.64; 1;05; 1.46), an optimization function to obtain the minimum solves... Excel Solver To perform these tasks without using the…
excelanswered danieltakeshi 3,960 -
2
votes1
answer73
viewsA: I cannot perform color conversion after image rotation
After converting to gray, you lose all color information BGR. So it is not possible to perform the conversion from gray to colored. What happens when you convert from grayscale for BGR with…
-
0
votes1
answer666
viewsA: VBA - How to identify last active line, when has formula
Considering a datasheet called "Data" and a with formulas "Panel" Enter a condition formula =SE() in the formula to leave the line empty if there is no data in the sheet "Data" with: =SE(Dados!A1,…
-
1
votes1
answer247
viewsA: Remove eye shine on image
Upshot The image on the left is the original one and the one on the right one without reflection. Code import cv2 import numpy as np import urllib.request resp =…
-
0
votes1
answer131
viewsA: Specify last line to fill in form - VBA
You can add a conditional if to quit the function if you pass line 90. Code With the following code: 'Verifica se a Linha é maior do que 90 If Linha > 90 Then MsgBox "Você não pode mais inserir…
-
1
votes1
answer1069
viewsA: How to merge multiple Excel spreadsheets into one?
It is possible with the use of VBA Code: Selects the files you want to merge Copy the title only from the first file. Copy from column A to the last column (in the case of example "B"), if the sheet…
excelanswered danieltakeshi 3,960 -
1
votes1
answer89
viewsA: How to delete straight parentheses from some subfolders I have using an excel macro?
This can be accomplished as follows: Choice of the main folder Loop in folders and subfolders for listing these Write the folders and subfolders found in a temporary worksheet called "temp",…
-
1
votes2
answers602
viewsA: Error splitting image in half using Python
To complement the reply, other ways to get width. .Hape from Opencv With a print() in img.shape, it is possible to verify that a tuple is returned as follows: (altura, largura, número_de_canais)…
-
3
votes1
answer2289
viewsA: How to remove image noises using opencv - python?
Solution Creation of the mask with: morphologyEx with cv2.MORPH_CLOSE cv2.blur to blur the image Binarization with the flag cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU Floodfill to eliminate the corners…
-
4
votes1
answer490
viewsA: Stereo camera calibration via openCV chessboard
With ret, corners = cv2.findChessboardCorners(img, (5, 4),cv2.CALIB_CB_ASYMMETRIC_GRID), you are using the pattern matrix (5, 4). But if you look at the printed chessboard, the pattern sheet is (7,…
-
0
votes1
answer311
viewsA: Peak value of a histogram
The value of maximum Y and maximum X can be found with the function max() and numpy.Where ymax = max(histr) xmax, _ = np.where(histr == ymax) print(xmax, ymax) Code import cv2 import numpy as np…
-
3
votes1
answer992
viewsA: Image segmentation with Canny Edge Opencv
The Canny Edge the way it is being implemented is leaving a pupil very small and similar to the noises created by eyelashes. I think the black color Slice is the best option to extract the pupil,…
-
1
votes1
answer446
viewsA: Copy lines and paste based on a value in an excel cell
The simplest way to check the amount of days in a month is the following: Ano = 2018 Mes = 2 DiasNoMes = Day(DateSerial(Ano, Mes + 1, 0)) MsgBox DiasNoMes Which returns number 28, that is, the month…
-
1
votes1
answer1627
viewsA: Plate recognition - Opencv - Tesseract
The library pytesseract is used for OCR. The .traineddata was created from the "Mandatory" source, which is the used in automotive plates and saved with the name Mandatory.traineddata Code try: from…
-
0
votes2
answers2022
viewsA: Add paragraph in vba
New Line For a new line in VBA it is possible to use the following options: | Constante | Equivalente | Descrição |…
-
0
votes1
answer151
viewsA: Rename attachments before saving
You can use the following code to perform this string manipulation: arquivo = objAttachments.Item(i).FileName nome_arquivo = fso.GetBaseName(arquivo) extensao_arquivo = Replace(arquivo,…
-
2
votes1
answer87
viewsA: Depth in some opencv methods
Depth It is the Data Type of each element of the image, that is, the accuracy of each pixel. The more bits per pixel, the better the representation of color differences and intensities. On the other…
-
1
votes1
answer84
viewsA: How to display separate characters from different sequences by skipping spaces in Excel
Solution With the formula used, it is possible to find only continuous values in the string. Then it is necessary to find the antepenultimate value and the last and then concatenate, but error may…
excelanswered danieltakeshi 3,960 -
0
votes1
answer1319
viewsA: VBA to send email
Example where you can choose the mode as HTML or image: Code Sub Envia_Email() Dim modo As String 'Escolhe modo ou "html" ou "imagem" 'modo = "html" modo = "imagem" Application.DisplayAlerts = False…
-
0
votes2
answers4373
viewsA: Use VBA to delete lines with a cell-determined criterion
Example Assuming two spreadsheets, one called "Sheet 1" and another "Sheet 2". The data are inserted in "Planilha1", according to the following table: | | A | |---|----------------| | 1 | | | 2 |…
-
2
votes2
answers403
viewsA: How to extract only the penultimate character from a sequence and then use auto-refilling in Excel
Solution To obtain the penultimate cell item, use the following function in the first cell and then the auto-refilling. Formula =ARRUMAR(ESQUERDA(DIREITA(SUBSTITUIR(""&ARRUMAR(A1);" ";REPT("…
excelanswered danieltakeshi 3,960 -
0
votes2
answers372
viewsA: How to show 2 rows in Listbox
Solution A non-contiguous Range needs to be created with each desired Range and in the end fill the Listbox with this data. With ListBox.RowSource, listbox is populated with the desired range.…
-
0
votes1
answer1384
viewsA: Sleep or Wait function catching spreadsheet in Excel
Solution The function Wait suspend the processing of Excel. Then the following code alternative should be used to stop only the code and not the Excel Spreadsheet. TempoEspera = Now() +…
-
1
votes1
answer1110
viewsA: Color detection and tell which color is appearing
Solution Create two subplots in matplotlib, one is webcam the other a rectangle with the dominant color Use the FuncAnimation to animate the graph in matplot, updating it every 200 ms Use the Opencv…
-
6
votes1
answer1913
viewsA: Regex to validate national document number
Use this regular expression: (?=.*\d)[A-Za-z0-9]{1,11} In which the demo on Regex101 can be seen. Explanation (?=.*\d) - Positive Lookahead, which ensures that at least one number is present in the…
-
2
votes1
answer722
viewsA: How to plot graphically with the colors of each pixel of the image?
Solution Convert to CIELAB using Opencv. First illustrates the 2D graph, with each color channel. Then the 3D graph for each Channel. Code import numpy as np import cv2 from matplotlib import pyplot…
-
1
votes1
answer252
viewsA: EXCEL. "Right" function how to set an automatic size for separate cells that exceeds the number of defined characters
The last word is being found incorrectly. Two forms that can be used to find the last word: =DIREITA(H1;NÚM.CARACT(H1)-PROCURAR(" ";H1)) The problem with this function is that it only works for two…
excelanswered danieltakeshi 3,960 -
6
votes1
answer1206
viewsA: How to remove area of interest from the background of an image?
To extract you can use the Grab Cut opencv A example can be seen in the tutorial "Interactive Foreground Extraction using Grabcut Algorithm" Code Using the example code: import numpy as np import…
-
0
votes1
answer66
viewsA: How to fetch excel sheet info to drop down in Visual Basic
Upshot Code Dim ws As Worksheet Dim UltimaLinha As Long, i As Long Dim ValorTrim As String Dim unicos As Collection Dim intervalo As range Set unicos = New Collection Set ws =…
-
0
votes1
answer131
viewsA: Limit Formulaarray
In addition to what @Isac said about decreasing the path size Rmts to get 255 characters. A replacement can be performed as follows: Any string is inserted in the Formulaarray instead of Rmts…
-
0
votes1
answer83
viewsA: How to change position values for a given resource?
With this test data: You can accomplish this with the following code, where the explanation is in the comment: Sub teste() Dim ws As Worksheet Dim UltimaLinha As Long, i As Long Dim rng As Range Dim…
-
0
votes2
answers131
viewsA: Whiten figure VBA Excel
Single image of the spreadsheet If it is the only image of the worksheet, use the following code that transforms the index 1 image to grayscale. Dim ws As Worksheet Set ws =…
-
1
votes2
answers1315
viewsA: Python and Opencv add points and Houghline
The idea of solution I found was the following: Upload image Pull out the green Threshold to binarize Find lines with Probabilistic Hough Transform Skeletonize or Thin Upload image img =…
-
0
votes1
answer1488
viewsA: Error 381 listbox.list VBA
The error occurs because there is no item in the list. So either you add an item at the beginning of the list and there will be a null line, with: Me.ListBox1.AddItem and checks that it is void…
-
1
votes1
answer548
viewsA: Indexerror: list index out of range Python
This is a problem because of the change from Opencv 2.4 to Opencv 3, so some ways are used to circumvent this problem, giving compatibility between versions. In your code, this is being done the…
-
2
votes2
answers126
viewsA: Is there any Excel function that returns the body of another function?
A User Defined Function (UDF) can be created for Excel 2010 or earlier versions: Function MostraFormula(Rng As Range, Optional asR1C1 As Boolean = False) As String If asR1C1 Then MostraFormula =…
excelanswered danieltakeshi 3,960 -
0
votes1
answer1579
viewsA: Histogram Python Opencv
CalcHist function You are using the function calcHist that has these input parameters: cv2.calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) images : is the source image of…
-
2
votes1
answer1231
viewsA: Opencv error in Python:
You are not loading the Cascade files, try using the absolute path of the Opencv library. Find Way import os import cv2 print(os.path.dirname(cv2.__file__)) That will return something of the kind in…